LockType Property - ADO

Indicates the type of locks placed on records during editing.

Applies To

Recordset

Required Files

msado15.dll
VC: adoint.h, adoid.h

Settings and Return Values

Sets or returns one of the following LockTypeEnum values:

Constant Description
adLockReadOnly (Default) Read-only — you cannot alter the data.
adLockPessimistic Pessimistic locking, record by record — the provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately upon editing.
adLockOptimistic Optimistic locking, record by record — the provider uses optimistic locking, locking records only when you call the Update method.
adLockBatchOptimistic Optimistic batch updates — required for batch update mode as opposed to immediate update mode.

Remarks

Use the LockType property to determine what type of locking the provider should use when opening a Recordset object or to return the type of locking in use on an open Recordset object. The LockType property is read/write when the Recordset is closed and read-only when it is open.

Providers may not support all lock types. If a provider cannot support the requested LockType setting, it will substitute another type of locking. To determine the actual locking functionality available in a Recordset object, use the Supports method.

Note To use batch updating, you should set the CursorType property to either adOpenKeyset or adOpenStatic, set the LockType property to adLockBatchOptimistic, and set the CursorLocation property to adUseClient (or its synonym adUseClientBatch) to enable the Microsoft Client Cursor Engine, which is required for batch udates.

Examples

CursorType, LockType, EditMode Properties Example (VB)

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.