OleDBConnection Closes executes but leaves the Access database locked

D

doni

Hi,

I have a .NET DLL with a COM callable wrapper. The main entry point
establishes a connection to an Access 2000 database. The connection
is used as the active connection to different SQL commands.

The last line of the entry point of the DLL calls
m_Connection.Close. The IDE does not throw an exception. It
executes the close command, changes the State to closed, but it
leaves the Access database locked. The .LDB file remains and is in
use. When Dispose is called the state of the database is shown be
closed.

The only other connection is made by a strongly typed dataset which I
added using the table adapter wizard.

I have double checked that I am not establishing any other
connections. I have double checked that the m_Connection.Close
command is being called. The .LDB file remains after the call.

Do I need to do something to get the table adapter I added from the
toolbar to close it's connection.

I am suppose to release for integration testing this week but I can't
get the connection to close.

Thanks,
DMD
 
D

DMD

Hi,

I have a .NET DLL with a COM callable wrapper. The main entry point
establishes a connection to anAccess2000database. The connection
is used as the active connection to different SQL commands.

The last line of the entry point of the DLL calls
m_Connection.Close. The IDE does not throw an exception. Itexecutesthe close command, changes the State to closed, butitleavestheAccessdatabaselocked. The .LDB file remains and is in
use. When Dispose is called the state of thedatabaseis shown be
closed.

The only other connection is made by a strongly typed dataset which I
added using the table adapter wizard.

I have double checked that I am not establishing any other
connections. I have double checked that the m_Connection.Close
command is being called. The .LDB file remains after the call.

Do I need to do something to get the table adapter I added from the
toolbar to close it's connection.

I am suppose to release for integration testing this weekbutI can't
get the connection to close.

Thanks,
DMD

I found the problem. There were several OleDBCommands and
DataAdapters that went out of scope. I explicitly called cmd.Dispose
and da.Dispose. The references to the database were cleaned up.
When I Dispose called m_connection.Close the database actually
closed.

I hope this helps someone in the future.

:)
 

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

Top