I have an ASP page that runs two SQL insert statements at the beginning before displaying the page. In the event I get a primary key conflict (ie. the inserts have already ran that day), I just want to carry on.
My code is basically:
on error resume next
' insert statements
Once the statements have been executed, I would like to resume the default error behaviour, where the page dies with an error message.
Is there a command, like “on error stop”, or “on error die”, or “on error default”, or something to reset the error handling to it’s default behaviour?
If you want it to throw an error without going to any sort of custom error handler, use:
You can test it out in a quick sample ASP page with the following:
With
On Error Goto 0commented out,Byewill get written as normal. WithOn Error Goto 0enabled, you’ll get the following error: