Click to See Complete Forum and Search --> : Data Comparison in VBScript/ASP


ASPSQLVB
12-15-2006, 10:45 PM
Gang,

I have a column of data I want to LOOP through to see if it is equal to EACH NUMBER in a column in another table.
Basically, looping through the data in Column 1 in TABLE 1 until EOF , then in the other table MOVENEXT and repeat the process over until EOF. Below is the code.

I am showing no data. Just an empty result set.

Do Until RS.EOF

Do Until RS2.EOF

Dim vntPegNumber2,vntPegNumber
vntPegNumber = RS("PegNumber")
vntPegNumber2 = RS2("PegNumber")

IF vntPegNumber2 = vntPegNumber Then

Response.Write "<tr align=""center"">"
Response.Write("<td><font color=""White""><b>" & RS("PegNumber") & "</b></font></td>" & vbCrlf)
Response.Write("<td><font color=""White""><b>" & RS("LastName") & " " & "and" & " " & RS2("LastName") & "</b></font></td>" & vbCrlf)
Response.Write("<td><font color=""White""><b>" & CheckData(RS("State")) & "</b></font></td>" & vbCrlf)
Response.Write("<td><font color=""White""><b>" & RS("Country") & "</b></font></td>" & vbCrlf)
Response.Write("</tr>")

Exit Do
Else

If RS2.EOF = True Then

Response.Write "<tr align=""center"" bgcolor=""ORANGE"">"
Response.Write("<td><font color=""473c8b""><b>" & RS("PegNumber") & "</b></font></td>" & vbCrlf)
Response.Write("<td><font color=""473c8b""><b>" & RS("LastName") & "</b></font></td>" & vbCrlf)
Response.Write("<td><font color=""473c8b""><b>" & CheckData(RS("State")) & "</b></font></td>" & vbCrlf)
Response.Write("<td><font color=""473c8b""><b>" & RS("Country") & "</b></font></td>" & vbCrlf)
Response.Write("</tr>")

Exit Do
End If

End If
RS2.MoveNext
Loop
RS.MoveNext
Loop

ASPSQLVB
12-16-2006, 12:34 AM
Problem Solved!!!!