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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiuser who can modify the same data? 3

Status
Not open for further replies.

xpblueScreenOfDeath

Programmer
Sep 1, 2004
87
How can I prevent two users from modifying the same data at about the same time, and notify the later user that the record is readonly because another user is currently modifying the data? What is the best way to deal with this because the web applications is always disconnect from the data? I don't want to hold a lock too long or it will block everyone else.
 
usually it is better to do with timestamp field to restrict multiple user being modifying same record. Or by using locks.
 
It depends on what DB you are using. There is no way in Sql server to manually lock a record. What I have done in the past is to create a bit column as a flag. I then check that flag and if that flag is set (flg = 1) then I don't allow that data to be edited/updated. Once the row has been updated, I set the flag back (flg = 0), which would then allow some one else to edit the data.


Jim
 
let's be optimistic here ;-).

if you use the dataadapter it will do it for you.

otherwise you will have to do it yourself. Lockng a record is never a good idea (what if it never gets released?)

what I would do is
- save a copy of the original data
- let the user edit a copy
- on update check to see if your original is still the same as the one on the server. if not don't save else save.


Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top