This doesn't look too difficult. One way would be to develop a custom error page, which means you'd need to replace the default one used by IIS. You'd need to be able to access IIS manager to do it, which usually does not happen when you are hosted in someone else's server.
Another way would be to catch the error yourself, in your code. To stop the generic error handler to be executed when an error occurs you need to use a On Error Resume Next statement. This means that the code execution won't be stopped and that the statement following the one where you have the error will be executed. So, you'd need to add code to check for an error following every statement that could generate such an error.
With statements that access databases using ADO, you can check errors by examining the errors collection of the connection object:
if my_conn.Errors.Count > 0 then
realErrors = 0
'Loop through the errors
For Each objError in my_conn.Errors
if objError.Number <> 0 then 'catching only error messages, not warnings or informational messages, where Number=0
'Now you know this as an error related to the database access, you could do whatever you wanted, maybe showing
' the text message or other info about the error. I'm just counting the real errors
realErrors = realErrors + 1 ' increment the count
end if
Next
'Now you can test the number or real_errors and redirect to a different page, if you want
if realErrors > 0 then Response.Redirect ("myDBErrorPage.asp")
end If
Hope this helps.