asp_databases thread: error trapping
Message #1 by "Inanna" <inanna@d...> on Wed, 18 Apr 2001 23:13:43
|
|
When error trapping everything seems to work fine when I deliberately
break something... trapping some errors using "Server.CreateObject
("ADODB.Error")" and others using "objErr in objConn.Errors" BUT if the
database file I am trying to connect to with the connection string doesn't
exist I get the error
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
Hopefully it will never occur but if it does how can I trap this error?
Message #2 by "Thor Burfine" <tburfine@k...> on Wed, 18 Apr 2001 23:38:14
|
|
place a call to the error trapper in the adovb.asp page
or what ever page you use to create the ADO connection in
Thor
> When error trapping everything seems to work fine when I deliberately
> break something... trapping some errors using "Server.CreateObject
> ("ADODB.Error")" and others using "objErr in objConn.Errors" BUT if the
> database file I am trying to connect to with the connection string
doesn't
> exist I get the error
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC Microsoft Access Driver] Could not find
file '(unknown)'.
> Hopefully it will never occur but if it does how can I trap this error?
>
Message #3 by "Dallas Martin" <dmartin@z...> on Wed, 18 Apr 2001 19:49:57 -0400
|
|
On Error Resume Next
Connection.Open(connectionString)
If err.number <> 0 then
....do something
end if
----- Original Message -----
From: "Inanna" <inanna@d...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, April 18, 2001 11:13 PM
Subject: [asp_databases] error trapping
> When error trapping everything seems to work fine when I deliberately
> break something... trapping some errors using "Server.CreateObject
> ("ADODB.Error")" and others using "objErr in objConn.Errors" BUT if the
> database file I am trying to connect to with the connection string doesn't
> exist I get the error
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
> Hopefully it will never occur but if it does how can I trap this error?
Message #4 by "Inanna" <inanna@d...> on Thu, 19 Apr 2001 11:50:02
|
|
Thankyou Thor.... I had the error trap call AFTER the objConnection.Open
call so the error wasn't trapped because it was too late. I didn't realise
that an error can occur when the connection is defined DUHH!!! so I put
the call straight after it and it works fine now. I am soooo happy :)
> place a call to the error trapper in the adovb.asp page
> or what ever page you use to create the ADO connection in
>
> Thor
|