ADO » Recordset » LockType

LockTypeEnum = recordsetobject.LockType
recordsetobject.LockType = LockTypeEnum

Sets or returns a LockTypeEnum value that defines the type of locks that arein effect while editing records.

The LockType property sets or returns one of the LockTypeEnum constants that indicates the type of lock in effect on a record for editing. The default is read-only.

You can only set this value when the Recordset is closed. Some providers do not support all of the lock types. If a provider does not support the requested value, it will substitute another value. After the Recordset is opened, you can return this property to determine the specific value being used.

LockTypeEnum Constants

Constant Value Description
adLockBatchOptimistic 4 Multiple users can modify the data and the changes are cached until BatchUpdate is called
adLockOptimistic 3 Multiple users can modify the data which is not locked until Update is called
adLockPessimistic 2 The provider locks each record before and after you edit, and prevents other users from modifying the data
adLockReadOnly 1 Read-only data
adLockUnspecified -1 Lock type unknown


Set objRecordset = Server.CreateObject("ADODB.Recordset")
Set objRecordset.ActiveConnection = strConnection
objRecordset.LockType = adLockOptimistic
objRecordset.Open "ChantList", , , , adCmdTable

See Also: