473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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.....
Jul 22 '05 #1
3 1705

"June Moore" <ju******@yahoo.com.au> wrote in message
news:e5*************************@posting.google.co m...
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 />")
Jul 22 '05 #2
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

"June Moore" wrote:
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.....

Jul 22 '05 #3

http://powerasp.com/content/new/on-e...esume-next.asp
"June Moore" <ju******@yahoo.com.au> wrote in message
news:e5*************************@posting.google.co m...
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.....

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jonathan | last post by:
I am looking for a simple way to check if a database table exists. I keep getting advice to use "Try.. Catch" and other error handling methods, but I obviously don't want to have to display an...
16
by: Steve Jorgensen | last post by:
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before...
6
by: Peter Dunker | last post by:
Hello, I think I have a newbee question. If I create a char pointer at the beginning of function and use it only in a special case: char *name; if (a = 1)
11
by: zhong | last post by:
Error Message: Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention...
6
by: SamSpade | last post by:
Public Function PicCreateGraphics() As Graphics 'Client should dispose this PicCreateGraphics = Graphics.FromImage(mDocumentImage) mPicCreateGraphicsSaved = PicCreateGraphics 'Saved so I can...
14
by: Ørjan Langbakk | last post by:
I have a form where the user has the possibility to enclose his name. email, address and phonenumber. I want to be able to check if some of the fields are filled - at least one. This is so that...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
5
by: Gary Wessle | last post by:
hi or is there a better way to check the existence of "py" in a string "s"? string s = "djrfpyfd"; string t = "py"; string r = s.substr(s.find("py"),2); cout << (t==r) << endl;
18
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning...
55
by: lovecreatesbea... | last post by:
Do you check all error conditions for all library calls in you code? Is it necessary to check all errors? Is it convenient to check all errors (or how to make code clean and readable with mass of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.