Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO recordset-locking problem?

Status
Not open for further replies.

Norsky

Programmer
Jul 23, 2001
3
US
Is there a way to lock a record in a recordset and prevent other users from reading that same record? I would like to create a locking scheme in a multi-user environment where each user will pull up a unique record for updating. I would like to prevent other users from pulling up the same record. For example, I want user1 to pull up record A, view it and then submit an update without giving any other users access to that same record until this process has completed. If user2 submits the same query as user1 at the same time, I would like this user to see the next available record.
 
U could to do by yourself by putting the users to modify just the records that's corespond to them...
I dont think there is an methot to prevent a part of users from not updating an recordset (not theyrs but others)
all u have to do is to catch the querry of the client an modify them to update just his recordset or u could identify each user and modify the records witch has the userid
________

George
 
This most DEFINITELY is possible.. With database locks.

ADO Expliticly uses Database locks.. In order to make sure that another user cannot modify the data you care currently viewing or updating, you can have ADO Request UpdateLocks (another user can request a read lock, not a write lock)- meaning that you eliminate deadlocks (two sources with read locks at the same time, so neither can get a write lock) if you use a Server-Side Cursor with a Pessimistic Lock.

Code:
    rstRecordset.CursorLocation = adUseServer
    rstRecordset.LockType = adLockPessimistic

--NipsMG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top