ADO API Reference (ADO Method)

zhaozj2021-02-17  59

GetChunk method

Returns all or part of the large text or binary data Field object.

grammar

Variable = Field.getChunk (size)

return value

Return the variable body.

parameter

Size long integer expressions, equal to the number of bytes or characters to be retrieved.

Description

Some or all long binary or character data are retrieved using the getchunk method of the field object. In the case where the system is limited, the GetChunk method can be used to handle the portion instead of all long integer values.

The data returned by the getChunk call will assign it to the "variable". If size is greater than the remaining data, getChunk only returns the remaining data without populating the "variable" with a blank. If the field is empty, the getChunk method returns NULL.

Each subsequent GetChunk call will retrieve data starting from the previous GetChunk call stop. However, if the data is retrieved from a field and then set or read in the current record, the ADO will consider the data from the first field. If the getchunk method is called again on the first field, the ADO will interpret the call as a new GetChunk operation and start reading from the beginning of the record. If other Recordset objects are not a copy of the first RECORDSET object, the fields that are accessed do not destroy the getChunk operation.

If the Adfldlong bit in the Attributes property of the Field object is set to True, you can use the getChunk method for this field.

If there is no current record when using a getchunk method on the field object, an error 3021 (no current record) is generated.

GetRows method

Restore multiple records of the RecordSet object to an array.

grammar

Array = RecordSet.Getrows (Rows, Start, Fields)

return value

Returns the two-dimensional array.

parameter

Rows optional, long integer expression, specifying the number of records to retrieve. The default is adGetrowsRest (-1).

START optional, string or long integer, calculates a bookmark that is recorded at the beginning of the getRows operation. You can also use the following bookmarkenum values.

Constant Description AdbookMarkCurrent starts from the current record. AdbookMarkFirst starts from the first record. AdbookMarkLast starts from the tail record.

Fields optional, variable body, represent a single field name, sequential location, field name or sequential location number. ADO only returns data in these fields.

Description

Use the getRows method to copy the record from the Recordset to a two-dimensional array. The first subscript identification field, the second, identifies the record number. The array variable will be automatically adjusted to the correct size when the getRows method returns data.

If you do not specify the value of the ROWS parameter, the GetRows method will automatically retrieve all records in the Recordset object. If the requested record is more than available, GetRows only returns the number of available records.

If the Recordset object supports bookmarks, you can specify which record will start retrieving data by transmitting the BookMark property value of the record.

To limit the fields returned by getRows call, you can transfer a single field name / number or field name / number array in the fields parameter.

After calling getRows, the next unread record becomes the current record, or if there is no more records, the EOF property is set to TRUE.

GetString method (Ado Recordset)

Return the Recordset as a string.

grammar

Set variant = Record.getstring (StringFormat, Numrow, ColumnDelimiter, Rowdelimiter, Nullexpr) Return Value

Return the RecordSet by a string value (BSTR) of the string value.

parameter

StringFormat Specifies that the Recordset should be converted to the following format.

Constant Description Adclipstring row is bound by the RowDelimiter, column by columndelimiter, and null values ​​are bound by Nullexpr. These three parameters are only valid when they are together with Adclipstring.

Numrows are optional. Record the number of rows to be converted. If you do not specify NumRows, or it is greater than the total number of records, all rows of record sets are converted.

ColumnDelimiter is optional. If specified, it is a delimiter between the columns and columns, otherwise it is TAB character.

Rowdelimiter is optional. If specified is a delimiter between the rows and rows, otherwise the carriage returnif character.

Nullexpr is optional. If specified, the expression at the null value, otherwise a null string.

Description

Row data (but not mode data) is saved in the string. Therefore, you cannot use this string to reopen the recordset.

This method is equivalent to the RDO getClipstring method.

ITEM method

Returns a specific member of the collection based on the name or serial number.

grammar

Set Object = Collection.Item (INDEX)

return value

Return object reference.

parameter

Index variants, calculate the name or sequence number of the object in the collection.

Description

Use the ITEM method to return a specific object in the collection. If the method cannot find an object in a collection corresponding to the index parameter, an error will occur. At the same time, some collection does not support named objects, and for these collections, sequence number reference must be used.

The ITEM method is the default method of all collections; therefore, the following syntax form is interchangeable:

Collection.Item (Index)

Collection (INDEX)

Move method moves the location of the current record in the Recordset object. Syntax RECORDSET.MOVE NUMRECORDS, Start Parameter NumRecords with symbol long integer expressions, specify the number of records moving in the current recording position. START optional, string, or variable body type for calculating bookmarks. You can also be one of the following bookmarkenum values:

Constant illustrates AdbookMarkCurrent default. Start from the current record. AdbookMarkFirst starts from the first record. AdbookMarkLast starts from the tail record. Note All Recordset objects support MOVE methods. If the NumRecords parameter is greater than zero, the current recording location will move forward (at the end of the recordset). If the NumRecords is smaller than zero, the current recording position moves backward (starting to the start of the record). If the MOVE call moves the current record position to the first record, the ADO places the current record before the first record of the recordset (BOF TRUE). Attempting to move backward will generate an error when the BOF property has been True. If the MOVE call moves the current recording location to the tail record, the ADO places the current record after the recording set (EOF TRUE). At the EOF attribute has tried to move forward movement when the EOF property has been true. An error will occur from the empty RecordSet object call MOVE method. If the START parameter is transmitted, move the record relative to the bookmark (assuming the Recordset object supports bookmark). If not specified, the movement is relative to the current record. If you use the Cachesize property to cache records from the provider locally, the ADO will have to start retrieving a new record group from the target record while transmitting the NumRecords parameters other than the current recording location to the current cache. The Cachesize property determines the size of the new retrieval group, and the target record is the first record that retrieved. If the Recordset object is forward, the user can still transmit the NumRecords parameters that are less than zero (as long as the target is in the current collection of the recorded record). If the MOVE call moves the current recording location to the first record of the first cached record, an error will occur. Therefore, you can use a recording cache, which supports full scrolling on the provider that supports only forward scrolling. Since the cache record will be loaded into memory, it should be avoided unnecessary cache too much record. Even if only the backward movement of this approach supports this method, call the MovePRevious method only on any forward RecordSet object will still generate an error. Movefirst, MoveLAST, MoveNext and MovePrevious methods move to the first, last, next, or the previous record in the specified RECORDSET object and make the record become the current record. Syntax RECORDSET. {MoveFirst | MoveLast | MoveNext | MovePRevious} Description Use the MoveFirst method to move the current record position to the first record in the Recordset. Use the MoveLast method to move the current recording location to the last record in the Recordset. The Recordset object must support bookmark or backward cursor; otherwise call the method will generate an error. Use the MOVENEXT method to move the current record forward (to the bottom of the Recordset). If the last record is the current record and calls the MoveNext method, the ADO will set the current record to the tail record of Recordset (EOF TRUE). When the EOF property has tried to move forward movement, an error will occur. Use the MovePrevious method to move the current record position backwards (to the top of the recordset). The RecordSet object must support bookmarks or backbound; otherwise the method call will generate an error. If the first record is the current record and calls the MovePrevious method, the ADO sets the current record before the recording of Recordset (BOF TRUE). The BOF attribute will be moved backwards when TRUE will generate an error.

If the Recordset object does not support bookmarks or back cursors, the MovePrevious method will generate an error. If the record set is forward, but the user wants to support forward and backward scrolling, then you can create a recording cache with the cachesize property, and support the back cursor through the MOVE method. Since the cache record is loaded into memory, it should be avoided to unnecessarily cache too much record. You can call the MoveFirst method for forward RECORDSET objects; do this allows the provider to re-execute the command to generate the Recordset object. Movefirst, MoveLast, MoveNext, MovePRevious Method (RDS) Moved to the first, last one, next or the previous record in the displayed record set. Syntax Datacontrol.RecordSet. {MoveFirst | MoveLast | MoveNext | MovePrevious} Parameter Datacontrol object variable represents RDS.DataControl objects. Note You can use the RDS.DataControl object's MOVE method to locate the data binding control of the web page. For example, it is assumed that the recordset in the grid is displayed by binding to the RDS.DataControl object. You can then join "First", "Last", "Next" or "Previous" button so that users can click these buttons to move to the first, last, next, and previous record . For the "first", "last", "next" and "previous" buttons, you can implement the MoveFirst, MoveLast, MoveNext, and MoveElets methods of the RDS.DataControl object, respectively. The address book example will explain its specific method. NextRecordset methods Clear the current RECORDSET object and return to the next recordset by in advance. Syntax SET RecordSet2 = RecordSet1.NextRecordset (RecordsAffected) Return Value Returns Recordset object. In the syntax model, RecordSet1 and RecordSet2 can be the same RECORDSET object, or different objects can be used. The parameter RecordsAffected optional, long integer variable, the provider returns the number of records affected by the current operation. Note that this parameter returns only the number of records affected by the operation; it does not return a record from the selection statement used to generate RecordSets. Note The result of the next command in the composite command statement is returned using the NextRecordset method, or the stored procedure result of multiple results is returned. If you use a Command's Execute method or RecordSet Open method to open a RecordSet object based on a composite command statement (such as "Select * from Table1; Select * from Table2"), the ADO only performs the first command and return the result to the record set. ". To access the results of subsequent commands in the statement, call the nextRecordset method. As long as there are other results, the NEXTRECORDSET method will continue to return to the RecordSet object in the RecordSet that contains the composite statement. If the row returns the command does not return a record, the returned RecordSet object will be empty; the case can be verified if both BOF and EOF are True. If the return command is successfully executed by the row, the Rounted RecordSet object will be turned off, and this situation can be tested by testing the Recordset's State property. If there is no other result, the "Recording Set" will be set to Nothing.

转载请注明原文地址:https://www.9cbs.com/read-29975.html

New Post(0)