I have a DLL that copies an Access database, opens it, reads it, and then closes it. The second time through it is unable to copy the Access DB because the EXE has an open handle to it. The EXE does not reference the Access DB at all, it just has the open handle because it calls my DLL. After I close the DB, I would like to terminate the EXE's handle to the Acess DB. BTS - I wrote the DLL and it is my Access DB. Another company wrote the EXE and I can not make any changes to it.


?mconnection
{System.Data.OleDb.OleDbConnection}
ConnectionString: "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=C:\Code\CCMC\HostBridge\JH&A Silverlake\BytePro\HostBridge.mdb;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False"
ConnectionTimeout: 15
Container: Nothing
Database: ""
DataSource: "C:\Code\CCMC\HostBridge\JH&A Silverlake\BytePro\HostBridge.mdb"
Provider: "Microsoft.Jet.OLEDB.4.0"
ServerVersion: "04.00.0000"
Site: Nothing
State: Open {1}

You can't terminate the file handle. You can only kill the process. Meddling with another processes resources will likely cause the application to raise an exception and close anyway.

Obviously if the application holds the database open it expects that subsequent calls to the database do not require reconnecting -- as it has already connected.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.