SQL Server Developer Center > SQL Server Forums > SQL Server Data Access > How to obtain a lock on MDB(Access) Database file?
Ask a questionAsk a question
 

AnswerHow to obtain a lock on MDB(Access) Database file?

  • Saturday, November 07, 2009 10:39 AMVibhor Agarwal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Using - Visual Studio 2005, C# Forms App, MS Access Database , Microsoft OleDB Jet Driver

    Problem -

    My Application(C#) uses an mdb file as a database. I want to obtain a lock on the entire file so that a user is not able to open/edit the mdb file using MS Access while the application is running.

    When one opens a mdb file with MS Access a hidden file is created of type "Access.LockFile.9" with the same name as that of the mdb file. MS Access implements lock in this way.

    How can i ?

    Any possible way?

Answers

  • Friday, November 13, 2009 5:08 AMNai-dong Jin - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    I suggest that you can create an account who is the only one that can edit/update the Access file, and in your case, that account is your application running account.
    Microsoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help.

All Replies

  • Friday, November 13, 2009 5:08 AMNai-dong Jin - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    I suggest that you can create an account who is the only one that can edit/update the Access file, and in your case, that account is your application running account.
    Microsoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Saturday, November 14, 2009 10:16 AMVibhor Agarwal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Nai-dong Jin,

    Couldnt understand what you wrote.
    Vibhor Agarwal