Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to determine if a connection is active

I am writing an addin that manages an ODBC/OLEDB connection to a
database. I manage to make the connection without trouble. However, I
would like to be able to determine if the connection is still active;
for instance, the database might drop the connection if a certain
amount of time has passed without activity. How can I determine if a
connection is active?

Many thanks,

Phil

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default How to determine if a connection is active



check the .State property
of the adodb.Connection object

anyway..
you should not needlessly leave the connection open.
close it when done. reopen when need.

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


wrote :

I am writing an addin that manages an ODBC/OLEDB connection to a
database. I manage to make the connection without trouble. However,
I would like to be able to determine if the connection is still
active; for instance, the database might drop the connection if a
certain amount of time has passed without activity. How can I
determine if a connection is active?

Many thanks,

Phil

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to determine if a connection is active

That works fine. I'm testing for .State = 1 to determine if a
connection is active. Would you happen to know the values that .State
can take on? I'm sorry to ask, but the ADODB help library isn't
installed on any of the machines I have access to.

And I agree with you that I shouldn't needlessly leave the connection
open. But I have rather a strange situation where it makes some sort
of sense to let the user manage the connection rather than trying to do
it in my program, and I prefer to test if the connection exists rather
than trap the error that occurs if it doesn't exist.

Thanks for the help.

Phil

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to determine if a connection is active

Excellent reference. Thank you. I should have searched harder after
finding the appropriate help file wasn't loaded.

Thanks,

Phil

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use active cell to determine range Gizmo Excel Discussion (Misc queries) 2 March 31st 08 04:55 AM
How to Determine if Application Window Still Active Edwin Kelly Excel Discussion (Misc queries) 3 June 26th 07 05:42 PM
Data Connection - Active Directory Rob Excel Discussion (Misc queries) 1 August 11th 06 06:56 PM
Can I determine the active selection's type? MartinS Excel Programming 4 January 13th 05 04:15 PM
Determine active file size pk Excel Programming 1 October 27th 03 03:46 PM


All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"