How to check if there is an error?...

J

June Moore

Hi,
I have the following ASP...
set dbconn = server.createobject("ADODB.connection")
dbconn.open "dsn=news;uid=hello"

After the dbconn.open, how do I check if the dbconn.open has an error?
e.g. if dbconn has error
do something...

Thanks,
June.....
 
V

Vinod

June Moore said:
Hi,
I have the following ASP...
set dbconn = server.createobject("ADODB.connection")
dbconn.open "dsn=news;uid=hello"

After the dbconn.open, how do I check if the dbconn.open has an error?
e.g. if dbconn has error
do something...

Thanks,
June.....


Using the onerror statement , if you want or by using it

dim objErr
set objErr=Server.GetLastError()
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("<br />")
 
G

Ganesh

Hi,
You can do one of these...

1. You can use the Errors collection of the connection object
2. You can check with the connection.state property whether it is open.
3. Have On Error Goto statement to trace any errors.

Ganesh
 

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

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,413
Latest member
ReeceDorri

Latest Threads

Top