Rs. Open SQL, Conn, a, B
Parameter A is the type of the Set cursor, and its value is:
0: Only forward cursor. Only forward browsing records are supported. pagination, recordset, and bookmark are not supported.
1. keyset cursor. The changes made by other users to the record will be reflected in the record set, but the addition or deletion of records by other users will not be reflected in the record set. Supports paging, recordset, and bookmark
2. dynamic cursors are the most powerful, but consume the most resources. The added or deleted records modified by the user on the record description will be reflected in the record set. Supports full-featured browsing.
3. The static cursor is only a snapshot of the data. The changes, additions, or deletions to the record statement by the user will not be reflected in the record set. Supports moving forward or backward
Parameter B is the lock type of the record set, and its value is:
1. Lock type. The default value is read-only and cannot be modified.
2. Lock the record immediately when editing. The safest way is
3. the record set is locked only when the update method is called. Other operations can still modify, insert, or delete the current record.
4. The record will not be locked during editing, and modification, insertion, and deletion are completed in batch processing mode.
There are more than one method to open a data record set, but the most common method is
Rs. Open SQL, method, but many people do not understand the following numerical parameters. Let's introduce them below.
In fact, the open method is followed by multiple parameters.
Cursortype locktype commandtype
For example, Rs. Open SQL
It can also be written
Rs. cursortype = 1
Rs. locktype = 1
Rs. Open SQL
Cursortype indicates the record returned from a table or an SQL query result.
This parameter has four values:
Adopenforwardonly indicates that only the records in the record set can be moved forward. This is the default value.
Adopenkeyset reflects the change or delete actions performed by other users on the record, but does not reflect the actions performed by other users to add new records.
Adopendynamic reflects the changes or deletions to records made by other users, including the newly added records.
Adopenstatic does not reflect the changes, adding or deleting actions made by other users to the record.
The four values are pre-defined bits of VBScript.
Adopenforwardonly = 0
Adopenkeyset = 1
Adopendynamic = 2
Adopenstatic = 3
Locktype indicates the type used by the data provider to lock the database when the record set is opened:
Adlockreadonly data cannot be changed. This is the default value!
Adlockpessimistic data provider locks the record when it starts to edit the data
Adlockoptimistic only when the update method is called, the data provider locks the record
Adlockbatchoptimistic for batch Modification
Their constant value definitions are:
Adlockreadonly = 1
Adlockpessimistic = 2
Adlockoptimistic = 3
Adlockbatchoptimistic = 4