Recordset object
Attribute
Attribute name data type and purpose
AbsolutePage can read and write the Long type, either set or return the page number of the current record, or a PositionEnum constant. For details, see the constants used by AbsolutePage. Before obtaining or setting the value of AbsolutePage, you must set the value of PageSize. AbsolutePage is counted from 1. If the returned value of AbsolutePage is 1 when the current record is on the first page, setting AbsolutePage will direct the current record pointer to the first record on the specified page.
AbsolutePosition * the type of Long that can be read and written (starts from 1), sets or returns the position at the year of the current record. The maximum value of AbsolutePosition is the value of the RecordCount attribute.
The String type that can be read and written by ActiveCommand. The name of the previously opened Command object associated with Recordset.
ActiveConnection pointer type, pointing to the previously opened Connection object associated with the Recordset, or to a complete valid ConnectionString value.
BOF * read-only Boolean type. If it is True, it indicates that the record pointer is located before the first record of Recordset and the current record is unavailable.
Bookmark * can read and write the Variant type. It returns a reference to a specific record or uses a Bookmark value to direct the record pointer to a specific record.
CacheSize * can be read and written to the Long type. It specifies the number of records stored in the local Cache. The minimum (default) value is 1. If the CacheSize value is added, the number of communications with the server can be reduced when the flow Recordset is used to obtain more records.
CursorLocation can read and write the Long type, specifying the location where the flow cursor can be located, that is, whether the CursorType is located at the client or on the server side, see the constant used by CursorLocation. The default value is the cursor provided by the ole db data source.
CusrsorType * supports reading and writing the Long type and specifies the type of the Recordset cursor. For details, see the constant used by CursorType. The default value is forward-only cursor.
DataMember pointer type, pointing to the associated DataEnvironment. Command object
DataSource pointer type, pointing to the associated DataEnvironment. Connection object
EditMode * read-only Long type. The Recordset editing status is returned. For details, see the constant used by EditMode.
EOF * read-only Boolean type. If it is True, it indicates that the record pointer has exceeded the last record of Recordset and the current record has not been found.
The Filter * can read and write the Variant type, either a conditional expression (a valid SQL WHERE clause without the reserved word WHERE) or a Bookmark array pointing to a specific record, it is either a Filter constant. For details, see the constants used by the Filter.
LockType * can read and write the Long type, specifying the record lock method used to enable Recordset. The default value is read-only, which corresponds to the read-only feature of the forward-only cursor. See the constants used by the LockType attribute.
MarshalOptions can read and write the Long type. It specifies the record set to be returned after the client changes. This attribute is only applicable to uncommon ADOR. recordset object, which is RDS. ADOR. one of the Recordset object members.
MaxRecords * supports read and write of the Long type. It specifies the maximum number of records returned by SELECT queries or stored procedures. The default value is 0, indicating that all records are returned.
The PageCount read-only Long type returns all the pages of the Recordset. The PageSize value must be set. The return value of PageCount is truly meaningful. If Recordset does not support the PageCount attribute, the returned value is-1.
PageSize can be read and written to the Long type, and sets or returns the number of records contained in a logical page. The logic page can be used to break down a large Recordset into several small parts that are easy to process. The common practice is to set PageSize to the number of records displayed by the DataGrid, MsFlexGrid, or Hierarchical FlexGrid Control. PageSize is irrelevant to the page size used to lock the Jet (2 k) or SQL Server (6.5 and earlier versions, 2 k; 7.0, 8 k) database.
PersistFormat can read and write the Long type, and sets or returns the format of the Recordset File Created by calling the Save method. Currently, there is only one adPersistADTG value (default format: Advanced Data TableGram)
RecordCount * read-only Long type. If Recordset supports approximate positioning or bookmarks, the number of records contained in the Recordset with a flow cursor is returned. If not, you must use the MoveLast method to obtain the exact RecordCount value that indeed overwrites all records. If one or more records exist in the forward-only type Recordset, the Recordset returns-1 (True). 0 (False) is returned for Blank Recordset of any type)
Sort * can be read and written to the String type. It contains an SQL ORDERY BY clause that does not contain the reserved word 'ORDER BY' and is used to specify the sorting method of the Recordset.
Source * can be of the String type and can be an SQL statement, table name, stored procedure name, or related Command object name. If the Command object name is provided, Source returns the value of Command. CommandText. The lngOptions parameter of the Open method can be used to specify the type of the value provided to the Source.
State can be read and written to the Long type, which is one of the object State constants. See State constant
Status read-only Long type, indicating the Status after Recordset is batch processed or other bulk operations. See the constant used by the Status attribute.
Note: The attributes listed in the table above are the standard attributes of the ADODB. Recordset object, that is, those attributes supported by most common ole db data providers of relational databases. The attribute with an asterisk indicates that it is identical or very close to the corresponding attribute of DAO. Recordset or rdoResultset object.
Method
Usage
AddNew * adds a new record to the updatable Recordset. The call syntax is rstName. AddNew [{varField | avarFields}, {varValue | avarValuese}], where varField is a single field name and avarFields is an array of field names. VarValue is a single field value, and avarValue is an array composed of the values of the specified field in avarFields. Call the Update method to add the new record to the database table. If a record is added to a Recordset where the primary key is not the first field, you must specify the name and value of the primary key in the AddNew method.
Cancel cancels the execution of asynchronous queries, aborts the stored procedure or composite SQL statement to create multiple recordsets, and calls the syntax rstName. Cancel
CancelBatch * cancels the batch update operation of the Recordset whose LockEdit value is BatchOptimistic. The call syntax is rstName. CancelBatch [lngAffectRecords]. The value of the optional parameter lngAffectRecords can be found in the constant used
Clone copies A Recordset object with an independent record pointer. The call syntax is Set rstDupe = rstName. Clone ()
Close closes the Recordset object. You can reset the Recordset attribute and use the Open method to access Recordset again. Call Syntax: rstName. Close
Delete * If the LockEdit attribute value of Recordset is not set to adLockBatchOptimistic, Delete the current record from Recordset and the corresponding table immediately
Find finds records that meet the specified conditions. The call syntax is: rstName. find strCriteria [, lngSkipRecords, lngSearchDirection [, lngStart], WHERE strCriteria is an SQL WHERE clause without the WHERE keyword. The optional parameter lngSkipRecords is the number of records skipped before the application finds, lngDirection specifies the query direction (adSearchForward, and adSearchBackward, where adSearchForward is the default value). The optional parameter lngStart specifies where to start searching. Its value is either a Bookmark value or a Bookmark constant, see the Bookmark constant used by the varStart parameter.
GetRows returns a two-dimensional Variant array (rows and columns). The Calling syntax is avarname = rstName. getRows (lngRows [, varStart [, {strFieldName | lngFieldIndex | avarFieldNames | avarFieldIndexes}], where lngRows indicates the number of returned records, and varStart specifies where to start searching, the value is either a Bookmark value or a Bookmark constant. For details, see the Bookmark constant used by the varStart parameter. The third parameter can be the name or index of a single column (field), or a Variant array composed of multiple column names or indexes. If the third parameter is not specified, GetRows returns all columns in Recordset.
By default, GetString returns the String values of a specified number of records, which are separated by the return code. The records are separated by tabs. The call syntax is strClip = rstname. GetString (lngRows, [, strCloumnDelimiter [, strRowDelimiter, [strNullExpr]). LngRows indicates the number of returned records, strColumnDelimiter indicates an optional column separator (vbTab is the default value), strRowDelimiter indicates an optional row separator (vbCr is the default value), and strNullExpr indicates an optional parameter, used to replace Null values (the default value is a Null String ). GetString is mainly used to process the MSFlexGrid or MSHFlexGrid control by setting the Clip attribute of the control to strClip.
Move * Move the record pointer from the current record. The call syntax is: rstName. Move lngNumRecords [, varStart]. Here, lngNumRecords is the number of records to be skipped. The optional parameter varStart specifies where to Move. The value is either a Bookmark value or a Bookmark constant. For details, see the Bookmark constant used by the varStart parameter.
MoveFirst * moves the record pointer to the first record. The call syntax is: rstName. MoveFirst
MoveLast * moves the record pointer to the last record. The call syntax is: rstName. MoveLast
MoveNext moves the record pointer to the next record. The call syntax is: rstName. MoveNext. It is the only Move method that can be used for forward-only Recordset.
MovePrevious * moves the record pointer to the previous record. The call syntax is: rstName. MovePrevious.
NextRecordset returns another Recordset, which is usually created by a composite SQL statement that can generate multiple recordsets (such as SELECT * FROM orders; SELECT * FROM MERs mers) or a stored procedure. The call syntax is Next = rstName. NextRecordset [(lngRecordsAffected)]. The optional parameter lngRecordsAffected specifies the number of records returned to rstNext. If no Recordset exists, rstNext is set to Nothing.
Open Opens A Recordset on an active Command or Connection object. The call syntax is: rstName. Open [varSource [, varActiveConnection [, lngCursorType [, lngLockType [, lngOptions]. These parameters are optional,
Requery re-obtains the Recordset content from the table, which is equivalent to closed and then Open. It is a resource-intensive operation. Syntax: rstName. Requery
Resync * obtain some Recordset content from the table again. The call syntax is rstName. Resync [lngAffectRecords]. For the value of lngAffectRecords, see the constant used by lngAffectRecords. If this parameter is set to adAffectCurrent or adAffectGroup, it consumes less resources than adAffectAll (default.
Save creates an object that contains a Recordset permanent copy. The call syntax is rstName. Save strFileName. StrFileName indicates the path and file name. Generally,. rst is used as the file extension.
Supports returns True if the data provider Supports the specified cursor-related method. Otherwise, False is returned. The call syntax is Supported = rstname. Supports (lngCursorOptions). For more information about lngCursorOptions, see constants used by the Supports method.
Update * makes the modification to Recordset take effect for the table in the underlying data source. For batch operations, the Update method only takes effect for the locally (Cached) Recordset. The call syntax is rstName. Update.
UpdateBatch * changes made to the Recordset of the volume type (the value of LockType is adBatchOptimistic, and the value of CursorType is adOpenKeyset or adOpenStatic) take effect for the tables in the underlying data source. The call syntax is rstName. UpdateBatch [lngAffectRecords]. For the value of lngAffectRecords, see the constant used by lngAffectrecords.
Note: The ADODB. Recordset object does not support the Edit Method. To change ADODB. the value of one or more fields in the record of the Recordset object. You can use rstName first. fields (n ). value = varValue change the Value of the corresponding field to the required Value, and then run rstName. update.
Event
Event name trigger time
When the EndOfRecordset record pointer tries to move beyond the last record
After the FieldchangeComplete field value is changed
After the MoveComplete Move or Move... method is executed
After RecordsChangeComplete edits a single record
After the changes in the RecordsetChangeComplete cache take effect for the underlying table
Before WillChangField changes the field value
WillChangeRecord before changing a single record
Before the changes in WillChangeRecordset cache take effect for the underlying table
Before executing the WillMove Move or Move... Method
Note: The adReason parameter is almost used in the function header of the event processing module. For the value of this parameter, see the constant used by the adReason parameter.