Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - HowTo:Check if connection to db is open
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HowTo:Check if connection to db is open

 Post Reply Post Reply
Author
joshb View Drop Down
Groupie
Groupie


Joined: 26 June 2002
Location: United States
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshb Quote  Post ReplyReply Direct Link To This Post Topic: HowTo:Check if connection to db is open
    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.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Coco Brown View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2002
Location: United States
Status: Offline
Points: 245
Post Options Post Options   Thanks (0) Thanks(0)   Quote Coco Brown Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2003 at 12:45pm

if you know that the connection exists...

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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.