The complete open syntax in recordset is
CopyCodeThe Code is as follows: secordset. Open source, activeconnection, cursortype, locktype, options
Example: Rs. Open SQL, Conn, 1, 3
Cursortype is
Adopenforwardonly 0 defaults to the cursor type. To open the forward cursor, you can only move forward in the record set.
Adopenkeyset 1 enables the cursor of the keyset type and can be moved forward or backward in the record set. if another user modifies or deletes a record, the change is reflected in the record set. however, if another user adds a new record, the new record will not appear in the record set.
Adopendynamic 2 enables a dynamic cursor that can be moved forward or backward in the record set. Any change to the record caused by other records will be reflected in the record set.
Adopenstatic 3 open the static cursor, which can be moved forward or backward in the record set. However, the static cursor does not reflect any change in the record caused by other users.
Locktype is
Adlockreadonly 1 read-only lock, specifying that records in the record set cannot be modified.
Adlockprssimistic 2: A protected lock that is immediately locked when a record is edited.
Adlockoptimistic 3 open locks, specifying that records can be locked only when the update () method of the record set is called.
Adlockbatchoptimistic 4 open batch lock, the specified records can only be updated in batches.
The two most common methods are as follows:
Rs. Open SQL, Conn, ', read-only
Rs. Open SQL, Conn, 'used for updating or inserting data, read and write