There may be other, better ways to do this, but here's one suggestion.
Enclose your code that opens the connection inside an on error resume next
block and check the connection state yourself in the code. If the connection
is not open, then redirect the user to a page that displays your error
message (Or display it in line in the page).
Don't forget to reset your error handling after you are done.
Here's some pseudo code to give you an idea.
On Error Resume Next
Set oConn = Server.CreateObject("ADODB.Connection")
szConnStr = "PROVIDER..." ' Connection string goes here.
oConn.Open szConnStr
If oConn.State = 1 THEN ' Connection open
'Process your code for the database
Else ' Connection NOT open
'Process your error message(s)
End If
On Error .... 'To reset your error handling.
Hope that will at least point you in the right direction.
[quoted text, click to view] "Drew" wrote:
[quoted text, click to view] > Is it possible to show a generic error page when a user doesn't have access
> to the SQL Server? As it is now, if a user doesn't have permission to a DB
> on the SQL Server, and navigates to a page or app that uses that DB, it
> gives them a "Page cannot be found" error, with more abotu the error below.
> I would like to show a friendly "You do not have permission to access this"
> instead.
>
> Thanks,
> Drew
>
>