SQLException

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi,

I am trying to trap a SQLException erro in my Global.asax
file but I am unable to do it. In my Application_Error
code block I have a simple response.write followed by a
response.end but when a SQLException error (violation of
primary key) occurs this code does not execute, however it
does execute if I receive a Compiler error, is it not
possible to trap these types of exceptions globally?

Thanks in advance for any help with this

Dave
 
By the time application_error fires, the request is dead. You can't write
anything out or do a redirect or anything like that. This has nothing to do
with the fact that this is a SqlException.

Try handling Page_error in your page.
 
Back
Top