Home > ASP Development > If no data found then send a message

If no data found then send a message



Hello everybody,



I have this little problem and I'm kind of new with ASP, so please give a help. What I'm doing is to show people data from database with ASP, but when there's nothing to show, ASP brings the browser with an error where only people like us knows what it means so what I want to know is how can I make ASP go to another page where I can explain the user that there's no data ralated to that new search and that he or she needs to try again?.



Thanks in advance for your help

    
Guest


Hi there, welcome to the forum



the most common way of doing this is something

like this:


Code:



rs.Open "select * from table", conn

if rs.EOF then
'no data exists
response.write "no records returned"
response.end
'or in your case, if you want to go to another page
response.redirect "no_data_page.asp"
else
'display records
end if




hope this helps

Was this answer helpful ? Yes No   
Guest


It should, I use the same code.

Was this answer helpful ? Yes No   
Guest


Thanks a lot for your help.

Is working very well now.



Quote:
Originally Posted by nofriends
Hi there, welcome to the forum



the most common way of doing this is something

like this:


Code:



rs.Open "select * from table", conn

if rs.EOF then
'no data exists
response.write "no records returned"
response.end
'or in your case, if you want to go to another page
response.redirect "no_data_page.asp"
else
'display records
end if




hope this helps

Was this answer helpful ? Yes No   
Guest


no problem, glad its working

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved