Forums
This topic is locked
how can I trap sql error
Posted 20 years ago
1
has voted
20 years ago david johnson posted:
I am using asp with sql database, master detail page behavior. How can I trap sql errors as a result of a bad qurey. if the user relaces the record id in he url string with a id that is not in the data base an SQL error is shown in the browser.see below how can you trap this and send it to another page?
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
--------------------------------------------------------------------------------
Please try the following:
Click the Refresh button, or try again later.
Open the localhost home page, and then look for links to the information you want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/dashboard/dashboard.asp, line 35
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Page:
GET /dashboard/dashboard.asp
Time:
Friday, January 21, 2005, 1:04:58 PM
More information:
Microsoft Support
Replies
Replied 20 years ago
20 years ago Chris Charlton replied:
Knowing how in ASP would be great.
Just for details, you planning to pass the error(s) to a database (of errors) or email them to a tech email?
Just for details, you planning to pass the error(s) to a database (of errors) or email them to a tech email?
Replied 20 years ago
20 years ago Vince Baker replied:
Hi,
To get around this you can check to see if the recordset is empty and if so, redirect:
Put this in the code view just after your recordset.
<%
if yourrecordsetname.eof and yourrecordsetname.bof then
Response.redirect("your_redirect_page.asp"
end if
%>
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)
VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
To get around this you can check to see if the recordset is empty and if so, redirect:
Put this in the code view just after your recordset.
<%
if yourrecordsetname.eof and yourrecordsetname.bof then
Response.redirect("your_redirect_page.asp"

end if
%>
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)
VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
Replied 20 years ago
20 years ago Lee Diggins replied:
Hi David
I came across a ErrorLog db a while back and have implemented this on most of my applications. You need to change the ASP error file to the new version and setup the db with a new user. It will then insert all errors in the Errorlog db and I've set mine to email our support department with all of the necessary error codes, descriptions and the name of the app where the error took place. Then give me a history of app errors.
Here's the article:
www.15seconds.com/issue/020821.htm
Doesn't take a lot of setting up especialy if you're used to providing your own error pages. Set it up once and it's available then for you to include in all applications.
Post back if you have any further questions.
Digga
Sharing Knowledge Saves Valuable Time!!!
I came across a ErrorLog db a while back and have implemented this on most of my applications. You need to change the ASP error file to the new version and setup the db with a new user. It will then insert all errors in the Errorlog db and I've set mine to email our support department with all of the necessary error codes, descriptions and the name of the app where the error took place. Then give me a history of app errors.
Here's the article:
www.15seconds.com/issue/020821.htm
Doesn't take a lot of setting up especialy if you're used to providing your own error pages. Set it up once and it's available then for you to include in all applications.
Post back if you have any further questions.
Digga
Sharing Knowledge Saves Valuable Time!!!
Replied 20 years ago
20 years ago Simon Martin replied:
Lee that link is awesome!
I will be setting something like that up on my Applications in future
Live the life you love
Love the life you live
Simon
[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
I will be setting something like that up on my Applications in future
Live the life you love
Love the life you live
Simon
[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
Replied 20 years ago
20 years ago Lee Diggins replied:
Hi Simon
Yes I thought the same when I found it.
Helps with debugging during dev too.
Post questions if you have any.
Digga
Sharing Knowledge Saves Valuable Time!!!
Yes I thought the same when I found it.
Helps with debugging during dev too.
Post questions if you have any.
Digga
Sharing Knowledge Saves Valuable Time!!!
Replied 20 years ago
20 years ago Simon Martin replied:
I'm going to set this up at work - a little tinkering should mean we only need to set this up once and have it monitor all our applications here. As you say ideal for Dev - but I'm also going to include this on a few sites I look after.
FANTASTIC <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Live the life you love
Love the life you live
Simon
[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
FANTASTIC <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Live the life you love
Love the life you live
Simon
[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]