My personal preference would be rather to create a custom error page :
http://support.microsoft.com/default...b;EN-US;224070
You could send a mail with error details and behave differently on your
development server.
IMO the key advantage is that you won't trap the same way things you are not
prepared for (for example the code below will show always a "database not
found" even if the problem is somewhere else in the connection string).
To trap for this specific error I would just test the file existance (using
Scripting.FileSystemObject) though this is IMO useless if you can't do
anything about it.
In short I would say :
- have a "catch all" page that display a generic message and mail details
- if you can do something when a particular condition is encoutered, handle
this at the code level (preferably byt testing before the error arise ie.
testing the file existance rather than trapping an error becuase the file is
not found etc...)
Patrice
--
"Evertjan." <ex**************@interxnl.net> a écrit dans le message de
news:Xn********************@194.109.133.29...
Andy Lee wrote on 24 jun 2004 in
microsoft.public.inetserver.asp.general:
I have a bit of code which executes an SQL statement.on my webpage.
If the execution fails i do not want a standard error coming up that
asp normally shows - instead i would like something like
if (cnn.execute) = failed Then
'Do This
End If
<%
on error resume next
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &_
Server.MapPath("notexisting.mdb") & ";"
if err.number <> 0 then
response.write "Database NOT found"
else
response.write "Database found"
end if
on error goto 0
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)