Subject | "with lock" SQL function |
---|---|
Author | bwc3068 |
Post date | 2008-11-27T00:32:43Z |
Hi--
I'm trying to do something very simple but can't figure it out.
I want to prevent more then one person from editing the same record
at the same time.
Right now, 2 different users can both put the same record into edit
mode in my application.
I want to prevent that.
About the only thing I could find online was adding a "with lock" to
the end of the SQL that puts the single record into edit mode. (I
start an explicit transaction before it goes into edit mode.)
But that doesn't give me what I'm looking for. When the record is
in edit mode, the other users cannot query the table for a read-only
result that includes the record that's locked. In my application,
there is a grid of records and that query is set to read-only. If a
user puts a record into edit mode and another user wants to display
the grid that includes that record, they end up with an error
message of "lock conflict on no wait transaction deadlock".
How do I prevent 2 users from both putting the same record into edit
mode at the same time?
Thanks
Kelly
I'm trying to do something very simple but can't figure it out.
I want to prevent more then one person from editing the same record
at the same time.
Right now, 2 different users can both put the same record into edit
mode in my application.
I want to prevent that.
About the only thing I could find online was adding a "with lock" to
the end of the SQL that puts the single record into edit mode. (I
start an explicit transaction before it goes into edit mode.)
But that doesn't give me what I'm looking for. When the record is
in edit mode, the other users cannot query the table for a read-only
result that includes the record that's locked. In my application,
there is a grid of records and that query is set to read-only. If a
user puts a record into edit mode and another user wants to display
the grid that includes that record, they end up with an error
message of "lock conflict on no wait transaction deadlock".
How do I prevent 2 users from both putting the same record into edit
mode at the same time?
Thanks
Kelly