Visual Basic: RDO Data Control
Retrieves multiple rows of an rdoResultset into an array.
array = object.GetRows (rows)
The GetRows method syntax has these parts:
|array||The name of a Variant type variable to store the returned data.|
|object||An object expression that evaluates to an object in the Applies To list.|
|rows||A Long value indicating the number of rows to retrieve.|
Use the GetRows method to copy one or more entire rows from an rdoResultset into a two-dimensional array. The first array subscript identifies the column and the second identifies the row number, as follows:
To get the first column value in the second row returned, use the following:
col1 = avarRows(0,1)
To get the second column value in the first row, use the following:
col2 = avarRows(1,0)
If more rows are requested than are available, only the available rows are returned. Use Ubound to determine how many rows are actually fetched, as the array is resized based on the number of rows returned. For example, if you return the results into a Variant called varA, you could determine how many rows were actually returned by using:
numReturned = Ubound(varA,2) + 1
The + 1 is used because the first data returned is in the 0th element of the array. The number of rows that can be fetched is constrained by available memory and should be chosen to suit your application dont expect to use GetRows to bring your entire table or result set into an array if it is a large table.
GetRows does not return data from columns whose ChunkRequired property is True a variant value containing an ODBC S-code is returned in these columns instead.
After a call to GetRows, the current row is positioned at the next unread row. That is, GetRows is equivalent to using the Move (rows) method.
If you are trying to fetch all the rows using multiple GetRows calls, use the EOF property to determine if there are rows available. GetRows returns less than the number requested either at the end of the rdoResultset, or if it cannot fetch a row in the range requested. For example, if a fifth row cannot be retrieved in a group of ten rows that youre trying to fetch, GetRows returns four rows and leaves currency on the row that caused the problem. It will not generate a run-time error.
The GetRows method fetches data from the ODBC buffers based on the RowsetSize property. RDO proceeds to fetch from the current row toward the end of the result set returning as many rows as you requested. As the current rowset is exhausted, RDO issues another SQLExtendedFetch function call to fetch subsequent rowsets from the database. This technique applies to all types of cursors.