PDA

View Full Version : Error checking bof or eof ?? Why



numbenator
09 Aug 2005, 08:07 AM
Can anyone identify why i am getting a server error on the below code.
Im trying to STOP an error occurring when therre are no records found. When no records are found, i pick up a server error.
Code resides in a sub.

Cheers



Set RSe = Server.CreateObject("ADODB.Recordset")
strSQLe = "SELECT * FROM experts where subjectid=" & request.queryString("id")
RSe.Open strSQLe, Conn
RSe.MoveFirst
if RSe.BOF or RSe.EOF then

response.write("<div style='margin-bottom:2px; border-bottom:1px solid #FF9900; width:auto;padding-left:2px;'>")
response.write("no experts found")
response.write("</div>")

else
Do While Not RSe.EOF
response.write("<div style='margin-bottom:2px; border-bottom:1px solid #FF9900; width:auto;padding-left:2px;'>")
response.write(rse("name"))
response.write("</div>")
response.write("<div style='padding-left:2px;'>")
response.write("<em>")
response.write(rse("current_post"))
response.write("</em>")
response.write("<div>")
response.write(rse("intro"))
response.write("</div>")
response.write("<a href='moreinfo.asp?expertid=")
response.write(rse("expertid"))
response.write("'>")
response.write("more info</a>")
response.write("</div>")
RSe.MoveNext
Loop
end if