Working with Multiple Rows of Data
The Fetch, Insert, Update, Remove methods of a connection use a RecordCount parameter and may operate on more than a single row at a time. However, the LCFiedllist parameter must have been created to hold more than one record for this to work. You may operate on fewer records than the Fieldlist was created with, but not more.
A simple example of different configurations for RecordIndex and RecordCount might be as follows:
Dim Records as New LCFieldlist (3, LCFIELDF_TRUNC_DATA)
Dim count As Long
Dim i As Long
...
Call connection.Fetch (Records, 1, 3) ' fetch up to three records
Call connection.Insert (Records, 3, 1) ' insert them
'in reverse order
For i = count To 1 Step -1
Call connection.Insert (Records, I, 1)
Print "IName(" & I & ") = " & Records.IName(i-1)
' retrieve a value from the array of IName field values.
Next
Note: Both parameters for New LCFieldlist are optional
and default to 1, and LCFIELDF_TRUNC_PREC, respectively. Likewise,
the RecordIndex and RecordCount parameters are optional
for Fetch, Insert, Update and Remove, and default to 1 and 1. Lastly,
the RecordIndex and RecordCount, when added to each
other (minus 1) must not exceed the size of the created Fieldlist.
If you retrieve multiple rows, the field (IName in this case) will have multiple values. Although the records are indexed starting at 1, the index of the array of field values starts at 0, so to read a field value from row n of the result, you should ask for Records.fieldname(n-1).
Note: It's not efficient to use the LCFieldlist.fieldname syntax
when reading a large result set. Refer to "Performance" (in this chapter)
for a better performing alternative. In either case, however, field
values are returned as an array and you must at some point specify
the array index.