Access Table Locking - Question2 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Access Table Locking - Question2

How can i lock the individual access tables in code? That is, only one copy of my application can access a table at the same time.

Thanx.

Comments

  • SaMoSaMo Posts: 36Member
    : How can i lock the individual access tables in code? That is, only one copy of my application can access a table at the same time.
    :
    : Thanx.
    :

    In the ADOTable properties change mode to ShareExclusive. If you then try to open the same table from another application, it will give you an Exception you can handle.

    Concerning the first question (reflecting changes in the table), I also had the same problem, but didn't manage to solve it. The only thing I can advise you is the Requery() method for the table. It recreates a local copy of the table for your application. However, my experience shows that it does not work instantly, meaning that after you changed the table (added, edited or deleted records) some 10-20 seconds should pass before the Requery method returns the correct results.

    Hope that helps.
  • _yilmaz_yilmaz Posts: 150Member
    Thank you, i'll try this.

    For detecting the changes, i thought about that but since i display the database in a tree view, loading the tree view at each time from the refreshed data set takes time.

    : : How can i lock the individual access tables in code? That is, only one copy of my application can access a table at the same time.
    : :
    : : Thanx.
    : :
    :
    : In the ADOTable properties change mode to ShareExclusive. If you then try to open the same table from another application, it will give you an Exception you can handle.
    :
    : Concerning the first question (reflecting changes in the table), I also had the same problem, but didn't manage to solve it. The only thing I can advise you is the Requery() method for the table. It recreates a local copy of the table for your application. However, my experience shows that it does not work instantly, meaning that after you changed the table (added, edited or deleted records) some 10-20 seconds should pass before the Requery method returns the correct results.
    :
    : Hope that helps.
    :

Sign In or Register to comment.