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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close a specific resource handle?

Status
Not open for further replies.

TheVampire

Programmer
May 1, 2002
828
US
I've got a VB.NET app that is leaking file handles despite me disposing of the OdbcConnection and OdbcCommand objects correctly. Eventually these file handles proliferate to the point of causing errors due to low system resources. I need to find out how to use the API to locate all file handles in use by my process, and shut down any that match a certain description (which is the path to the folder where the database is located). This has to be done automatically from within my program and not using any external utility. Any suggestions are appreciated.
 
Why do you known there are leaks?
In VB, data controls can keep data files open where you should think you closed them. If you wrote code to open a database and later you wrote code to close it, this doesn't mean all your databases are closed. Controls can hold some databases open. You also need to close them with extra code.
 
I don't use data controls. I do it all in code. Thanks for the suggestion though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top