View Single Post
 
Old March 22nd, 2007, 10:38 AM
cptclyde cptclyde is offline
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Directory not being released by process

I am creating a database connection to a .dbf file which is stored in a temp directory.
I open the connection and read from it using an OdbcDataAdapter object. Then I close the adapter and the connection.
When i try to then delete my temp dir named "128190509005573176" I get the following error/exception:

================================================== =================
The process cannot access the file 'C:\CARSMnet\bin\tmp\128190509005573176\' because it is being used by another process.
================================================== =================

Why won't the directory be released? It lets me delete the actual ".dbf" file i was working with but won't let me kill the parent dir.
Help?!?!?!

Here's my code:
OdbcConnection connection = new OdbcConnection(@"Driver={Microsoft dBase Driver (*.dbf)};DBQ=" + sTmpDirPath);

OdbcDataAdapter adapter = new OdbcDataAdapter("Select * from " + sTmpDirPath + "daox.dbf", connection);
System.Data.DataSet dataSet = new DataSet();

connection.Open();
adapter.Fill(dataSet);
                    
connection.Close();