LockEdits Property

See Also   Applies To

Sets or returns a value indicating the type of locking that is in effect while editing.

Syntax

BOOLGetLockEdits(VOID);

VOIDSetLockEdits(BOOL bFlag);

Parameters

Type Example Description
BOOL bFlag TRUE(Default) Pessimistic locking is in effect. The 2K page containing the record you're editing is locked as soon as you use the Edit method.

FALSEOptimistic locking is in effect for editing. The 2K page containing the record is not locked until the Update method is executed.


Remarks

You can use the LockEdits property with updatable CdbRecordset objects.

If a page is locked, no other user can edit records on the same page. If you set LockEdits to True and another user already has the page locked, an error occurs when you use the Edit method. Other users can read data from locked pages.

If you set the LockEdits property to False and later use the Update method while another user has the page locked, an error occurs. To see the changes made to your record by another user, use the Move method with 0 as the argument; however, if you do this, you will lose your changes.

When working with Microsoft Jet-connected ODBC data sources, the LockEdits property is always set to False, or optimistic locking. The Microsoft Jet database engine has no control over the locking mechanisms used in external database servers.

Note You can preset the value of LockEdits when you first open the CdbRecordset by setting the lLockEdits argument of the OpenRecordset method. Setting the lLockEdits argument to dbPessimistic will set the LockEdits property to True, and setting lLockEdits to any other value will set the LockEdits property to False.