none
none

Reputation: 4827

Close ado connection for access after finish update, and delete mdb file

I'm trying to delete the mdb file after finished reading it.

The process is:

copyFile(originMdb, to targetMdb);
mdbConnection.active := true;
mdbQuery.open;
readMdbFileData;
mdbQuery.close;
connection.close;
deleteFile(tagetMdb);

But there is an ldb file that is generated that will not disappear.

update: is there a way to tell the mdb, "i don't need any more connections now, close it, and remove the locks on the ldb file" instead the mdb engine is waiting for the process to end before it will release the connection that was made with adoConnection

update2: after creating a simple program that just opened and closed connection, the file is released, however since i hold an adoqury it refuses to releasea the file.

Upvotes: 0

Views: 2642

Answers (2)

Xarxas
Xarxas

Reputation: 97

you need to wait and its depending on the size or your database. but you can also delete the ldb directly by creating another function.

for example:

Dim locationFLD As String
locationFLD = "yourLocation"
If Dir(locationFLD & "\*.ldb") <> "" Then
   deleteFile(tagetMdb) & ".ldb";
End If

Upvotes: 1

David Xavier
David Xavier

Reputation: 21

you will need to wait for the connection to close and the jet engine to delete the ldb file. the ldb file is a lock file created by the Jet Database engine

Upvotes: 2

Related Questions