I want to populate an array with values from an ado recordset
(multiple rows)
I use the absolute position of the cursor in the recordset to define
the row of my array to be populated. I have a workaround for lack of
a way to define the ordinal position of a field (incrementing a
counter variable), but it feels so primitive:
dim Fld as Field
dim rst1 as new adodb.recordset
dim varArray()
dim intfieldmarker is integer
Redim varArray(rst1.r ecordcount, rst1.Fields.cou nt)
rst1.MoveFirst
Do While Not rst1.EOF
intfieldMarker = 0
For Each Fld In rst1.Fields
varArray(rst1.A bsolutePosition , intfieldMarker) = Fld
intfieldMarker = intfieldMarker + 1
Next Fld
rst1.MoveNext
Loop
If I used DAO, I could call the ordinal position of each field, and
use that to indicate the column of my array. But that method isn't
available with ADO, it seems. Does anyone know something a little
less risky than incrementing a counter?
Is it possible, for instance to store the field names in the first row
of the array, and then somehow use those fieldnames as pointers to the
column of the array? Just a thought...
(multiple rows)
I use the absolute position of the cursor in the recordset to define
the row of my array to be populated. I have a workaround for lack of
a way to define the ordinal position of a field (incrementing a
counter variable), but it feels so primitive:
dim Fld as Field
dim rst1 as new adodb.recordset
dim varArray()
dim intfieldmarker is integer
Redim varArray(rst1.r ecordcount, rst1.Fields.cou nt)
rst1.MoveFirst
Do While Not rst1.EOF
intfieldMarker = 0
For Each Fld In rst1.Fields
varArray(rst1.A bsolutePosition , intfieldMarker) = Fld
intfieldMarker = intfieldMarker + 1
Next Fld
rst1.MoveNext
Loop
If I used DAO, I could call the ordinal position of each field, and
use that to indicate the column of my array. But that method isn't
available with ADO, it seems. Does anyone know something a little
less risky than incrementing a counter?
Is it possible, for instance to store the field names in the first row
of the array, and then somehow use those fieldnames as pointers to the
column of the array? Just a thought...
Comment