locking database record for editing
Posted
by
sd_dracula
on Stack Overflow
See other posts from Stack Overflow
or by sd_dracula
Published on 2013-11-05T09:50:37Z
Indexed on
2013/11/05
9:53 UTC
Read the original article
Hit count: 283
I have a SQL 2008 DB and an asp.net frontend. I would like to implement a lock when a user is currently editing a record but unsure of which is the best approach.
My idea is to have a isLocked column for the records and it gets set to true when a user pulls that record, meaning all other users have read only access until the first user finishes the editing.
However, what if the session times out and he/she never saves/updates the record, the record will remain with isLocked = true, meaning others cannot edit it, right?
How can I implement some sort of session time out and have isLocked be automatically set to false when the session times out (or after a predefined period)
Should this be implemented on the asp.net side or the SQL side?
© Stack Overflow or respective owner