Trap asp errors

Results 1 to 2 of 2

Thread: Trap asp errors

  1. #1
    Join Date
    Dec 1969

    Default Trap asp errors

    How to trap asp errors like when delete,update,insert records in tables and display a suitable message to the user

  2. #2 Guest

    Default RE: Trap asp errors

    You can use "On error resume next" to prevent your script from displaying cryptic system messages, and you can test the Err system variable to see if your queries were successful and determine what error occurred if any. Err will equal zero if no error has occurred. <BR><BR>However, you should use this sparingly and makes sure that you do all necessary error checking in your code while error trapping is active. Always use "On Error Goto 0" to return to normal error mode as soon as you have completed the operations which you intended to do error handling. If you leave error trapping on globally during development, you script will not display errors and you could therefore be fooled into thinking that all is well when it is not.<BR><BR>Use of the custom error handling would look like this:<BR><BR>&#060;%<BR>On Error Resume Next &#039 Turn on custom error handling<BR>objConn.Execute YourSQLCommand<BR>If err = SomeErrorNo then<BR>&#039 Take appropriate action<BR>Endif<BR>On Error Goto 0 &#039 Turn off custom error handling<BR>%&#062;<BR><BR>As I said above, only turn it on where you absolutely need it, and turn it off as soon as possible. Also make sure that your error handling code if correct because while it is active no ASP errors will occur.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts