ADO LockType Property
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.
Set this property before opening the Recordset. 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.
Note: adLockPessimistic is not supported if CursorLocation is
set to adUseClient.
Syntax
Example
set conn=New ADODB.Connection
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "F:\Mydata\northwind.mdb"
set rs = New ADODB.recordset
sql="SELECT * FROM Customers"
rs.CursorLocation=adUseClient
rs.CursorType=adOpenStatic
rs.LockType=adLockBatchOptimistic
rs.Open sql,conn
rs.Close
conn.Close
|
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 |
|