Feedback on: irt.org FAQ Knowledge Base Q5822
Length:
Just right
Comments:
Your first example on looping through a recordset would cause an infinite loop, thus the true "newbies" might not appreciate it locking up their web server.
While Not rs.EOF
Response.Write ...
rs.MoveNext ' <--------
Wend
Worth:
Worth reading
Comments:
A better way I have found is to simply do:
if rs.BOF and rs.EOF then
Response.Write("No Records Returned")
else
'Do something with the returned records
end if
Checking for both the EOF and the BOF will ensure that the rs is really empty since you can only be at the end AND the beginning at the same time when there is nothing in the set.