Prevent any type of error...

M

Mike

How can you prevent the database error from displaying on
screen? Can you redirect users to a more friendly error
screen that is custom created. Using ASP/SQL Server. For
instance, if the database cannot be found, instead of
displaying,

Microsoft OLE DB Provider for SQL Server error '80004005'
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not
exist or access
denied.
/myConn.asp, line 7

Can you make it to where you could display something like
this:

"I'm sorry, a database error has occured, please try your
request later, click hyperlink for list of possibilities."

Mike
 
R

Ray at

Hello Mike,

There is the On Error Resume Next option and there is the option to create a
cutom 500 page (the default is that "Internal Server Error").

http://msdn.microsoft.com/library/en-us/script56/html/vsstmonerror.asp

This article explains how to create a custom 500 page, although it's not its
main focus.
http://www.aspfaq.com/show.asp?id=2335

Also, this article, while it's dealing with custom 404s, can also be applied
to 500 errors, although you don't need to grab the url out of the
querystring.
http://www.aspfaq.com/show.asp?id=2162

Ray at work
 
A

Aaron Bertrand [MVP]

on error resume next
conn.open "connection string"
if err.number <> 0 then
response.write "I'm sorry ... "
else
' ... work with database ...
end if

Another novel idea is testing your connection string before putting it live
on your site, and getting a provider where you can rely on your database
being up 24 x 7.

I know, pot, kettle, and all that. I'm working on a deal with a new
provider.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top