Print Page | Close Window

HowTo:Check if connection to db is open

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=1731
Printed Date: 28 March 2026 at 8:02am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: HowTo:Check if connection to db is open
Posted By: joshb
Subject: HowTo:Check if connection to db is open
Date Posted: 10 April 2003 at 7:37am

How would I go about checking to see if a connection to a db is open or active.

In some of my earlier sloppy coding days I didn't do this:

Set adoCon = Nothing
Set strCon = Nothing

So what I would like to do is find a way to to see if either is still open so I can close them.



-------------
I'm a wannabe programmer that knows how to do nothing but create invalid procedure arguments.
http://www.soopportal.com">



Replies:
Posted By: MorningZ
Date Posted: 10 April 2003 at 12:29pm
if IsObject( adoConn ) then
   Set adoCon = Nothing
end if


or (yuch)
On Error Resume Next
   Set adoCon = Nothing
On Error Goto 0


and it appears you are trying to "close a string" on the second line, not sure where you heard/read to do that, its not going to change anything..

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Coco Brown
Date Posted: 16 April 2003 at 12:45pm

if you know that the connection exists...

if myConnection.state = 1 then response.write "myConnection is opened"




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net