I need to compact and repair operations on the Access database. To do this, all open connections to the database must be closed . Unfortunately there are open connections which I can not always know and can close properly. Is there a way to disconnect all open connections through code?
There is nothing special about an access file compared to a text file, or a simple Sitting on Power Point disc We are talking about an Airplane Jane windows file.
So your real question is, can you disconnect a process that has a word file or an old file that is just sitting on the hard drive?
You may be able to kill the process and connection, but then you will not be able to ensure that the pending data will be written in that word file (or using MDB file).
So, for my knowledge, even if you can determine which process the power-point file is open, I do not think you can terminate the reliable process and that file Can be closed, which is open and make sure that the written data will actually be written in writing. You can not know whether the code and process are pending in waiting for the update disk to be written.
Failure to leave pending data in a power point file is not such a big thing, but in the case of data, you are asking for real problems.
The only real approach here is a beautiful and appropriate closure of the application / process, in which the Windows file is open
Try to get exclusive access to the file about all your code. If you can not do this, you have to inform the user that unless the exclusive use is done, the compact is not possible, the file can be obtained.
You can of course open the admin tool on the computer, and check the users who have the file, but killing those user connections is at your own risk.
Comments
Post a Comment