CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    6

    Hi! Is there anyone out there how can tell me how record lockting with DAO works. REWARD: 1 beer ca

    Hi everyone!

    When I use the Edit()-Methode to lock a recordset in a pessimistic-opened CDaoRecordset, the Edit()-Methode seemed to look more than
    one record! Does anybody know, why the Edit()-Method looks more than the current record? I would be nice I anyone will reply immediately
    because I will have to install this programm on Monday!

    DB.Open("d:\\projekte\\dblock\\dblock.mdb", FALSE, FALSE);

    pOrder = new CDaoRecordset(&DB);

    pOrder->Open(dbOpenDynaset, "select * from order order by order_nr", dbSeeChanges);

    pOrder->SetLockingMode(TRUE);

    pOrder->MoveLast();

    // Lock the current record! (or more?!)
    try {
    pOrder->Edit();
    }

    catch (CDaoException* e) {

    if(e->m_pErrorInfo->m_lErrorCode == 3260) {

    //...record is locked!
    }
    }

    When I start two applications on my system this works fine. The second application recognize that the last record is locked.
    But when I scroll forword in the second application, the previous 4 or 5 records are locked too. But there wqs only
    the last record locked by the first application! I tried to turn off the DAO-record caching by the following statements:

    pOrder->SetCacheSize(0);
    pOrder->SetCacheSize(0);
    pOrder.>FillCache();

    But this didn´t work too.

    I´m looking forward to any ideas, suggestions or what ever!

    Thanks!

    Marc


  2. #2
    Join Date
    May 1999
    Posts
    388

    Re: Hi! Is there anyone out there how can tell me how record lockting with DAO works. REWARD: 1 bee

    I could not get, what do you mean by 'locking' a record. I have used Edit to change the current recordset but i am sorry, could not get your problem.


  3. #3
    Join Date
    May 1999
    Posts
    4

    Re: Hi! Is there anyone out there how can tell me how record lockting with DAO works. REWARD: 1 bee

    DAO Lock Pages not only Single Records.


  4. #4
    Join Date
    May 1999
    Posts
    6

    Re: Hi! Is there anyone out there how can tell me how record lockting with DAO works. REWARD: 1 bee

    Hi Shahzad!

    With the locking of a record I mean that a record is exclusively locked for exactly ONE application
    at one time in a multiuser/network environment.for editing. If I would use no record locking this
    will produce different site effects, e.g. three applications witch are running at the same time, edit
    for example the description of a part at the same time. What will be the right part description?

    With record locking you can avoid such situations. My problem is, that the Edit()-Methode locks
    more than the current record. The Edit()-Methode locks 3 or 4 records before and behind the
    current record too! And so this means, that the other running applications on the network can
    not edit these records. For the current record this is what I want but not for the others.

    So the questions is: Why does the Edit-Methode() locks more than the current record?

    When you have any ideas i am looking forward to them - and don´t forget the reward :-) !

    Best regards,

    Marc


  5. #5
    Join Date
    Apr 1999
    Posts
    32

    Re: Hi! Is there anyone out there how can tell me how record lockting with DAO works. REWARD: 1 bee

    Whether locking is pessimistic or not, DAO locks the 2Kb page that contains your record. Pessimistic locking only determines when the locking occurs (on Edit() if pessimistic, else on Update()).

    If a particular page is locked, no other user can edit any records in that page, even if they are not the same record as the one being edited.



    --
    Daren Chandisingh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured