HELP close database connection

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

Can someone please help me close this db connection. I know the
connection is not closed because there;s a ldb file in my db folder.

dbCommand.Connection.Open();
IDataReader myReader = dbCommand.ExecuteReader();

while (myReader.Read())
{
return myReader.GetString(1);
}
myReader.Close();
dbCommand.Connection.Close();

Thanaks
 
Aaron,

How long have you waited for the LDB file to disappear? Unless you've been
tweaking the connection timeout values, you should wait at least a minute
after closing the connection since that's the default timeout for actually
releasing the connection from the connection pool after it's closed.

If you still see the LDB file after a minute has elapsed, check the
following:
1. Are there any other connections open to your db?
2. Does the user in whose context the code is running have permissions to
delete files from the containing folder? If not, the LDB file cannot be
deleted.

HTH,
Nicole
 
Back
Top