Rs. open SQL, conn, A, B
A:
ADOPenforwardonly (= 0)
Read-only, and the current data records can only be moved down.
ADOPenkeyset (= 1)
Read-only, the current data records can be freely moved.
ADOpendynamic (= 2)
It can be read and written, and the current data records can be moved freely.
ADOpenstatic (= 3)
Read/write: The current data record can be freely moved. You can see the new record.
B:
ADLockreadonly (= 1)
Default lock type. The record set is read-only and cannot be modified.
ADLockpessimistic (= 2)
Pessimistic locking: When a record is modified, the data provider attempts to lock the record to ensure that the record is edited successfully. The record is immediately locked as long as the record is edited from the beginning.
ADLockoptimitic (= 3)
Optimistic Locking: The record is locked until the updated record is submitted using the Update method.
ADLockbatchoptimistic (= 4)
Optimistic Locking in batches. Multiple records can be modified. Records are locked only when the update batch method is called.
When no record needs to be modified, the read-only record set should be used, so that the provider does not need to perform any detection. For general use, Optimistic Locking may be the best choice, because the record is locked for only a short period of time, and the data is updated during this period of time. This reduces the use of resources.
You can use the Recordset object to operate data from the provider. When using ADO, almost all data can be operated through the Recordset object. All Recordset objects are constructed using records (rows) and fields (columns. Some Recordset methods or attributes may be invalid because the functions supported by the provider are different.
Four different cursor types are defined in ADO:
Dynamic Cursor? Used to view the addition, modification, and deletion made by other users, and to move various types in Recordset that do not depend on bookmarks. You can use bookmarks if the Provider supports them.
Key set cursor? The behavior is similar to a dynamic cursor. The difference is that you are prohibited from viewing Records added by other users and accessing records deleted by other users. The data changes made by other users are still visible. It always supports bookmarks, so various types of movement in Recordset are allowed.
Static cursor? Provides a static copy of the record set to search for data or generate reports. It always supports bookmarks, so various types of movement in Recordset are allowed. The addition, modification, or deletion made by other users will not be visible. This is the only type of cursor that can be used to open the client (ADOR) Recordset object.
Forward cursor only? In addition to allowing only forward scrolling in records, the behavior is similar to a static cursor. In this way, high performance can be improved when one-way movement is required in Recordset.
Set the CursorType attribute to select the cursor type before opening the Recordset, or use the Open method to pass the CursorType parameter. Some providers do not support all cursor types. Check the documentation of the provider. If no cursor type is specified, ADO will open only forward cursor by default.
If the Recordset is enabled after the CursorLocation attribute is set to adUseClient, The UnderlyingValue attribute of the Field object is unavailable in the returned Recordset object. For some providers (such as Microsoft ODBC Provider for ole db and Microsoft SQL Server), you can use the Open method to pass the Connection string and create a Recordset object independently based on the previously defined Connection object. ADO still creates a Connection object, but it does not assign this object to the object variable. However, if you are opening multiple Recordset objects on the same Connection, you should create and open the Connection object explicitly, and then assign the Connection object to the object variable. If this object variable is not used when you open a Recordset object, ADO creates a Connection object for each new Recordset even if the same Connection string is passed.
You can create a required number of Recordset objects.
When Recordset is enabled, the current record is in the first record (if any), and the BOF and EOF attributes are set to False. If no record exists, the BOF and EOF attributes are set to True.
Assuming that the Provider supports related functions, you can use the MoveFirst, MoveLast, MoveNext, and MovePrevious methods as well as the Move method, and the AbsolutePosition, AbsolutePage, and Filter attributes to re-determine the location of the current record. Only the forward Recordset object supports only the MoveNext method. When you use the Move method to access each record (or enumerate Recordset), you can use the BOF and EOF attributes to check whether the movement has exceeded the start or end of the Recordset.
The Recordset object supports two types of updates: immediate update and batch update. Use immediate Update. Once the Update method is called, all changes to the data will be immediately written to the basic data source. You can also use AddNew and Update Methods to pass the array of values as parameters and Update several fields of the record.
If the provider supports batch update, the provider can store changes to multiple records in the cache, and then use the UpdateBatch method to send them to the database in a single call. This situation applies to changes made using the AddNew, Update, and Delete methods. After calling the UpdateBatch method, you can use the Status attribute to check and resolve any data conflicts.
Note that you should pass the query string to the Open method of the Recordset object to execute a query that does not use the Command object. However, to keep the Command text and execute it repeatedly or use query parameters, you still need the Command object.
AddNew creates a new Recordset object record that can be updated.
Append the object to the set. If the set is Fields, you can create a new Field object and then append it to the set.
AppendChunk appends data to a large text, binary data Field, or Parameter object.
BeginTrans, CommitTrans, and RollbackTrans manage the transaction processes in the Connection object as follows:
BeginTrans? Start a new transaction.
CommitTrans? Save any changes and end the current transaction. It may also start new transactions.
RollbackTrans? Cancels any changes made in the current transaction and ends the transaction. It may also start new transactions.
Cancel cancels pending, asynchronous Execute, or Open method calls.
Cancel (RDS) cancels the asynchronous execution or retrieval of the current operation.
CancelBatch cancels the pending batch update.
CancelUpdate cancels any changes made to the current record or new record before calling the Update method.
CancelUpdate (RDS) abandons all pending changes associated with the specified Recordset object to restore the value after the last Refresh method call.
Clear deletes all objects in the set.
Clone creates a copy Recordset object that is the same as an existing Recordset object. You can specify this copy as read-only.
Close closes open objects and any related objects.
CompareBookmarks compares two bookmarks and Returns their difference description.
ConvertToString converts A Recordset to a MIME string representing the record set data.
CreateObject (RDS) creates a proxy for the target business object and returns a pointer to it.
CreateParameter uses the specified property to create a new Parameter object.
CreateRecordset (RDS) creates an unconnected empty Recordset.
Delete (ADO Parameters Collection) deletes objects from the Parameters Collection.
Delete (ADO Fields Collection) deletes objects from the Fields Collection.
Delete (ADO Recordset) deletes the current record or record group.
Execute (ADO Command) executes the query, SQL statement, or stored procedure specified in the CommandText attribute.
Execute (ADO Connection) executes the specified query, SQL statement, stored procedure, or text of a specific provider.
Find searches for records that meet the specified criteria in the Recordset.
GetChunk returns all or part of the Field object of large text or binary data.
GetRows restores multiple records of the Recordset object to the array.
GetString returns the Recordset according to the string.
Item returns a specific member of the Set Based on the name or serial number.
Move Moves the position of the current record in the Recordset object.
MoveFirst, MoveLast, MoveNext, and MovePrevious move to the first, last, next, or previous record in the specified Recordset object and make the record the current record.
MoveFirst, MoveLast, MoveNext, and MovePrevious (RDS) Move to the first, last, next, or previous record in the displayed Recordset.
NextRecordset clears the current Recordset object and returns the next record set through the command sequence in advance.
Open (ADO Connection) opens the Connection to the data source.
Open (ADO Recordset) opens the cursor.
OpenSchema obtains the database mode information from the provider.
Query (RDS) returns A Recordset using a valid SQL Query string.
Refresh updates the objects in the set to reflect available objects from the provider and objects specific to the provider.
Refresh (RDS) re-queries and updates the ODBC data source specified in the Connect attribute.
Requery updates the data in the Recordset object by re-executing the query based on the object.
The Reset (RDS) performs sorting or filtering on the client Recordset Based on the specified sorting and filtering attributes.
Resync refreshes the data in the current Recordset object from the basic database.
Save (ADO Recordset) saves the Recordset (persistent) in the file.
Seek searches for the Recordset index to quickly locate the row that matches the specified value, and changes the position of the current row to the row.
SubmitChanges (RDS) submits the pending changes to the update Recordset cached locally to the ODBC data source specified in the Connect attribute.
Supports determines whether the specified Recordset object Supports specific types of functions.
Update saves all changes made to the current record of the Recordset object.
UpdateBatch writes all pending batch updates to the disk.