Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Will ADO Connection upon termination of an application

Status
Not open for further replies.

chimaera

Programmer
Oct 29, 2001
10
US
hi there...

fresh graduate here and a newbie to VB and ADO and i was wondering if a VB application will automatically close all connections and recordsets when the application terminates...

currently i have been using con.close and rs.close but my error handle cannot track how many of these connections are being open at a particular time... so i'm worried that at the 'end' statement in the error handler, the connections remain open...

i hope i can get an answer to this...

thanx

Peter
 
Hi,
when ur application end, It means that u have close your program. Then of course all the opened connections are closed automatically.
 
Good Programming practices suggests to close the connctions to database from with in your app, and not to wait for the application/OS to close it.
The point is not regarding the connection, but regarding the memory management.


Try this

In the MDIForms' (Or applications' main form) Unload event, write this..

Cn.Close
set Cn=Nothing

All the best All the Best
Praveen Menon
pcmin@rediffmail.com
 
Depends on how and where you opened the connection. If your application is using connection pooling via ODBC manager or via Component Services then NO the connections are not terminated for another 3 minutes. And in the case that you do terminate them they actually remain open for about 3 minutes waiting to be reused.
Implication is if you create a tempory object you should destroy it explicitely.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top