Rs. OPEN sql,conn,a,b
A:
adOpenForwardOnly (=0)
Read-only and the current data record can only move Down
adOpenKeyset (=1)
Read-only, the current data record is free to move
adOpenDynamic (=2)
Can read and write, the current data record is free to move
adOpenStatic (=3)
Can read and write, the current data record can move freely, can see the new record
B:
adLockReadOnly (=1)
Default lock type, Recordset is read-only, record cannot be modified
adLockPessimistic (=2)
Pessimistic locking, when a record is modified, the data provider attempts to lock the record to ensure that it is successfully edited. Lock the record immediately as soon as the editor starts.
adLockOptimistic (=3)
Optimistic locking is not locked until the update record is submitted with the Update method.
adLockBatchOptimistic (=4)
Bulk optimistic locking allows multiple records to be modified, and records are locked only after the UpdateBatch method is invoked.
When you do not need to change any records, you should use a read-only recordset so that the provider does not have to do any testing.
For general use, optimistic locking may be the best option because records are locked for a short period of time,
The data is updated during this time period. This reduces the use of resources.