...

View Full Version : while-loop



tanhaha_how
03-03-2006, 08:37 AM
why the table just can display the bank 1 record and without the bank 2 record....izzit the problem come from the while-loop???anyone can help me please???



response.write "<table border=1 align=center>"

Response.Write "<TR>" & vbCrLf
response.write vbCrLf & "<td colspan=3>Bank:1</TD>"
response.write "</tr>" & vbCrLf & vbCrLf


response.write "<tr>"
response.write "<td width=100 height=47 valign=top>Date<br>(dd-mm-yyyy)</td>"
response.write "<td width=265 valign=top>Email</td>"
response.write "<td width=52 align=center>Delete</td>"
response.write "</tr>"


Do While Not objRS.EOF
if objRS("bankID") = "1" then
Response.Write "<TR>" & vbCrLf
response.write vbCrLf & "<td>" & objRS("paymentDate") & "</TD>"
response.write vbCrLf & "<td>" & objRS("email") & "</td>"
response.write "<td align=center><input type=checkbox name=delete value=" & CInt(objRS("paymentID")) & ">Yes</td>"
response.write "</tr>" & vbCrLf & vbCrLf

end if
objRS.MoveNext
loop

response.write "</table>"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''

response.write "<table border=1 align=center>"

Response.Write "<TR>" & vbCrLf
response.write vbCrLf & "<td colspan=3>Bank:2</TD>"
response.write "</tr>" & vbCrLf & vbCrLf


response.write "<tr>"
response.write "<td width=100 height=47 valign=top>Date<br>(dd-mm-yyyy)</td>"
response.write "<td width=265 valign=top>Email</td>"
response.write "<td width=52 align=center>Delete</td>"
response.write "</tr>"


Do While Not objRS.EOF
if objRS("bankID") = "2" then
Response.Write "<TR>" & vbCrLf
response.write vbCrLf & "<td>" & objRS("paymentDate") & "</TD>"
response.write vbCrLf & "<td>" & objRS("email") & "</td>"
response.write "<td align=center><input type=checkbox name=delete value=" & CInt(objRS("paymentID")) & ">Yes</td>"
response.write "</tr>" & vbCrLf & vbCrLf

end if
objRS.MoveNext
loop

response.write "</table>"



thanks in advance

degsy
03-03-2006, 01:38 PM
if objRS("bankID") = "1" then
You've assigned a condition.
It will only loop if that is met.

Archangel
03-03-2006, 01:55 PM
Actually...I believe it's because you are at the end of your recordset.

Before your 2nd loop for Bank ID 2 starts try putting in

objRS.MoveFirst so it would be




objRS.MoveFirst
Do While Not objRS.EOF
if objRS("bankID") = "2" then
Response.Write "<TR>" & vbCrLf
response.write vbCrLf & "<td>" & objRS("paymentDate") & "</TD>"
response.write vbCrLf & "<td>" & objRS("email") & "</td>"
response.write "<td align=center><input type=checkbox name=delete value=" & CInt(objRS("paymentID")) & ">Yes</td>"
response.write "</tr>" & vbCrLf & vbCrLf

end if
objRS.MoveNext
loop

tanhaha_how
03-03-2006, 04:40 PM
okok.....i knew dee....thank you very much

Archangel
03-03-2006, 08:55 PM
Happy to help :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum