Jump to content
  • Advertisement
Sign in to follow this  

[web] ASP: What to do when query is empty

This topic is 5028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a pretty basic question in regards to queries on an ASP page. I have a record that is getting pulled from the database, but if there are no records it throws an error (no BOF or EOF). It would seem though that I cannot say 'if recordid = nothing then go to an error page', since it SEEMS to then be complaining that recordid does not exist. When making a query, and in the case there are no records to display, should there be anything special I should be doing in order to stop it throwing a server error?

Share this post

Link to post
Share on other sites
just check to see if there is a record before you try to use em.

if rst.EOF = false then
use record
do something else.
end if

if the data is all spread out and your no simply looping the recordset.

do the check to see if there are records and set a boolean flag on the results

then every place you use a record from the recordset do a check using the flag.

it could be your not actually creating the right objects mind.

post your code if you want.

Share this post

Link to post
Share on other sites
Generally when I get information in a recordset I loop through it like so:

while( NOT objRst.EOF )
'stuff - basically you do anything you want to the current row of the
' recordset here, then the next iteration will take care of the next row,
' and so on...


or when I'm really not expecting to use more than one record, I do something like:

if( NOT objRst.EOF ) then
'stuff to be done to current row in the recordset
end if

Hope that helps!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!