Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If query result (zero) records how can i display error message???

Status
Not open for further replies.

FlatHead

Programmer
Oct 13, 2000
50
GB
Seem that i was happy till i discovered this:
im using a query to access the database............

and always i was writing my pages following this format:

ssql = ssql & "......"

etc etc

oRecord.Open ssql, oconnect, 3

Response.Write &quot;<table>&quot;
If orecord.eof and orecord.bof then
Response.Write &quot;<br><h2 align = center>Sorry, there are no records to display.<h2><br>&quot;
else
Response.Write &quot;<table>&quot;
for loop.......
etc etc etc
Response.Write &quot;</table>&quot;
end if
close.....all

and this is how i was working till today 22 march one of the pages returned ZERO records.
Which means that my query identified (zero) from the table:)
I was thinking that :
if (oRecord.eof) and (oRecord.bof) sutisfies the ZERO records but unfortunatelly i have the following classic error:
ADODB.Recordset error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/tPar/hibandreport.asp, line 87
any sudgestions for something that satisfies completely zero records?????

 
Sure, try this before your OPEN statement.

oRecord.CursorLocation = 3 '(adUseClient if you use ado constants)

Then, when you're comparing EOF and BOF ... remove that, just check for the amount of records ...

If objRec.RecordCount = 0 Then
Response.Write &quot;<br><h2 align = center>Sorry, there are no records to display.<h2><br>&quot;

I hope this helps ...
Ed (RoadRacer) Holguin

&quot;I Hate Computers!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top