Locking Rows During Edit?
-
i am trying to figure out a solution for locking rows for editing via the web, the problem is i cannot figure out how to unlock the row effectively desired behavior: user 1 searches for and finds 3 records, clicks link to edit record 2 user 2 searches for and finds the same 3 records, goes to edit record 2, but gets "row locked" message, or likewise user 1, finished with editing user 2 can now edit the record problem is i cannot figure out how to track if user 1 finishes, IE closes the browser window... any thoughts on how i could possibly implement this? i will be using ASP.NET and T-SQL
-
i am trying to figure out a solution for locking rows for editing via the web, the problem is i cannot figure out how to unlock the row effectively desired behavior: user 1 searches for and finds 3 records, clicks link to edit record 2 user 2 searches for and finds the same 3 records, goes to edit record 2, but gets "row locked" message, or likewise user 1, finished with editing user 2 can now edit the record problem is i cannot figure out how to track if user 1 finishes, IE closes the browser window... any thoughts on how i could possibly implement this? i will be using ASP.NET and T-SQL
I would say...don't. Locking a row when a web user clicks to edit a record is a bad idea, for exactly the reasons you mention, you don't know if they're going to actually come back and submit any changes. If you really have to make sure that two users aren't editing the same data, use some sort of timestamp to detect whether someone else has made a change before saving the web user's changes. Marcie http://www.codeproject.com
-
I would say...don't. Locking a row when a web user clicks to edit a record is a bad idea, for exactly the reasons you mention, you don't know if they're going to actually come back and submit any changes. If you really have to make sure that two users aren't editing the same data, use some sort of timestamp to detect whether someone else has made a change before saving the web user's changes. Marcie http://www.codeproject.com
thanks! i suppose the timestamp thing is the best approach. i cannot have possible simultaneous edits work akwardly, i don't there to be lost data. So i guess i will have something akin to: On Edit screen load: Show current record contents, grab "last edited" On save: check "last edited" and if it matches: apply update, otherwise handle the problem, (probably best would be to show both sets of data)