ASP Forum
searching for occurrence in database
freezer86 | Posted 8:36pm 17. February 2008 Server Time |

hi i'm new to asp, i got this prob wyl working hope someone could help...

i have a to search every occurence of "i" - this should be from 10 - 15, in the field "ConNo" and if i found it i will hve to get the "date" and "status" the date should be the newest date entered in the db that's y i compare it to the data in the "Date" field I had set the " det" value to 1/1/1900, but it seems that it wont exit the loop..  Am I doing it right? I think not..=(
=====================================================
-my code goes like this:
i=10
Do while not rs.EOF
  while i <= 15
     if rs("ConNo") = i then
          if rs("Date") > det then
               det = rs("Date")
               if rs("Time") > tym then  
                   tym = rs("Time")
Response.Write("<tr >")
Response.Write("<td >"& " " &"</td>")
Response.Write("<td align='center'>&nbsp;"& rs("ConNo") &"</td>")
Response.Write("<td align='center'>&nbsp;"& rs("Status") &"</td>")
              else
                   tym = tym
              End if
        Else
             det = det
             tym = tym
        End If
        i = i + 1
  Else
    i = i
End if
wend


rs.MoveNext
Loop


rs.close
ado.close
set ado=nothing
set rs=nothing
===================================================
Informant | Posted 11:35pm 17. February 2008 Server Time |

An easier and more optimal way IF you are working against SQL Server is to just use the CharAt function and check to see if a integer value greater than 0 if it does you need to grab the other fields.


Reply to Post searching for occurrence in database



Back to Forum Page