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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top