Include general error-handling code in an asp page.
Defensive Programming - Handling Errors
There is a chance that your Web application will have an occasional error. Regardless of the quality of the application, there are other factors that can cause things to go awry,
such as database web applications. You should plan for this possibility and include some level of error handling in the application.
Handling errors in database-centered Web applications is really no different than handling errors in other types of applications. You just try to anticipate what could go wrong and add the necessary programming logic to catch and handle the error.
Types of errors
Typical database-related errors you should plan for include:
Failures to connect to a database
Failures to open a database
Sources of error problems
Errors can result from any of the following:
Security or administrative problem
Number of users already accessing the system
These can be used to respond in some manner to an error condition. The ToolTip below shows how the VBScript On Error Resume Next statement is used to trap an error condition.
The On Error Resume Next statement does not do anything about the error. Instead, it keeps the program from crashing.
Remember, handling the error is still the programmer's responsibility. The next lesson wraps up the module and concludes with a quiz.