PDA

Click to See Complete Forum and Search --> : Locked...


Tonatiuh
Jul 31st, 2000, 01:37 PM
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.

Clunietp
Jul 31st, 2000, 09:12 PM
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)

Gary.Lowe
Aug 1st, 2000, 02:58 AM
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

Tonatiuh
Aug 1st, 2000, 08:20 AM
Clunietp,
What error is the one I need to trap?

Thanks to Love.Lowe too.

Clunietp
Aug 1st, 2000, 11:29 PM
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...

Gary.Lowe
Aug 2nd, 2000, 03:08 AM
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.