Groups | Blog | Home
all groups > sql server clients > november 2003 >

sql server clients : Best practice for locking records (VB, ADO and SQL)



SeanGrebey
11/26/2003 8:31:02 AM
Andrew J. Kelly
11/26/2003 2:48:36 PM
You can add a timestamp column to the table and check the values of the one
when you originally got the row and what it is now. If it is different
somone else made a change in between and you can then handle it how you
wish.


[quoted text, click to view]
application? Here is the situation, I have a list of records that I use to
populate a form. On selecting a record (list box based), I query the
Database via an ADO Recordset (basic SELECT * WHERE ID = #####), and then I
populate my form with data (not data-aware controls). If any changes are
made, I set a flag, and then on exit prompt the User to save, and run an
Update statement to make changes. The obvious problem here is what happens
when another user comes along while this record is open and opens it as
well. Makes different changes, and then it is kind of a race to see who
saves last. I'm hesitant to put any kind of RecordLocked bit in there in
case of unexpected program termination. What is this best way to handle this
kind of record locking? Thanks.

AddThis Social Bookmark Button