tags:

views:

66

answers:

2

Here's a snippet of VB6 code:

myProjectDaoDB.Close
FileCopy myName, TempFile

where myName is the path of a database. This database is presumably closed in the first line. It seems that simply closing the database is not enough to properly remove all access to database since when I run the program, I get a run-time error of '70': Permission denied. I know that there are no actual problems with the user permissions. This error only happens after saving to the database, so I'm sure that something isn't being closed properly.

When the database is open, a lock file is created. If I run this code without making any changes to the database, the lock file is deleted after the first line runs. When I make changes to the database, the lock file is not deleted. There are no errors when it tries to close database, so why is it still there?

Update: I've followed the steps here to find out who has a connection to the database during the error. According to the results, When I try to close the connection without making changes to the database, it's only my connected. When I make changes, I'm connected twice. It seems then that myProjectDaoDB.Close is not closing all the connections. What gives?

A: 

It might be worth trying DBEngine.Idle dbRefreshCache

MarkJ
+1  A: 

Have you closed all the recordsets and set their object to Nothing?

Tony Toews