Redirect Web Users to a Warning Page when the Database Server is Down

Category:
ASP, HTML and XML
Type:
Snippets
Difficulty:
Beginning
Author:
yonggi choi

Version Compatibility: ASP

More information:
When you connect to a database on from an ASP page, and you're not sure the connection will be available, you can use this code to redirect the person to a custom error page; i.e., instead of the user seeing an error such as the following:

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][SQL Server]SQL Server has been paused. No new connections will be allowed. /LocalTaeyo/QAboard/S.asp, line 11

they will see a custom error message page which you create.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: