Deliberate DSN-Less Connection to SQL Server Database, Convert Error Message to Meaningful Text |
Deliberate DSN-Less Connection to SQL Server Database, Convert Error Message to Meaningful Text |
JohnnySteel |
Nov 5 2018, 10:13 PM
Post
#1
|
Newbie Group: Members Posts: 16 Joined: 8-June 16 Member No.: 24,307 |
Sorry, the heading should read "Deliberate DSN-Less Connection Failure to SQL Server Database". I couldn't change this as there does not appear to be means to do so.
I'm getting an (expected) error message with a DSN-Less connection to a SQL database on a SQL Server that says: "Microsoft OLE DB Provider for SQL Server error '80040e4d' Login failed for user '<username>'" Now, i know why the connection failed as it was deliberate on my part to cause this error. I want to trap this error and convert it to text to say the database is not available, such as when it is shut down to do software maintenance on it, etc., rather than display the error message like the one given above. How do i trap this error and convert it into some meaningful text on the web page to say the database is not available? The code i am using is ASP Classic. Thank you. This post has been edited by JohnnySteel: Nov 5 2018, 10:41 PM |
JohnnySteel |
Nov 6 2018, 07:39 PM
Post
#2
|
Newbie Group: Members Posts: 16 Joined: 8-June 16 Member No.: 24,307 |
Thank you. I'm not so much concerned about the error codes, etc., as i already have these defined. What I'm trying to do is to catch the failed connection event and convert the connection failure into words like "Database Unavailable" on the web page rather than showing the default error message as noted previously.
Trying to find that in MSDN is like looking for a needle in a haystack. This post has been edited by JohnnySteel: Nov 6 2018, 07:42 PM |
Lo-Fi Version | Time is now: 28th May 2024 - 06:34 PM |