I'm using VB6/ADO 2.1/Win9x/WinNT in a client/server environment. How can I know when the record I'm attempting to update is locked or is updating from another user.
Printable View
I'm using VB6/ADO 2.1/Win9x/WinNT in a client/server environment. How can I know when the record I'm attempting to update is locked or is updating from another user.
I don't think there is any straight-forward way of determining this, you might have to trap an error when you edit (for pessimistic locking) or when you update (for optimistic locking)
Tonatiuh
You can use the EditMode Property in ADO to see what state the record is in
EDITMODE PROPERTY
Indicates the editing status of the current record.
Return Value
Returns one of the following EditModeEnum values.
Constant Description
adEditNone Indicates that no editing operation is in progress.
adEditInProgress Indicates that data in the current record has been modified but not yet saved.
adEditAdd Indicates that the AddNew method has been invoked, and the current record in the copy buffer is a new record that hasn't been saved in the database.
adEditDelete Indicates that the current record has been deleted.
Hope this helps
Clunietp,
What error is the one I need to trap?
Thanks to Love.Lowe too.
Tonatiuh -- I'm not sure, you'll have to test for it
Gary -- does that work in a multi user situation? I assumed it was just for the local user...
Clunietp
I assume it works in a multi user env as I am working on a project at the moment in a multi user env.
I have used this locking method and it seems to work.
I will double check though and reply once I've sussed it out.