zion said:
Hello,
This is my code:
ArrayList MyArray= new ArrayList();
while (dbReader.Read())
{
object[] values = new object[dbReader.FieldCount];
dbReader.GetValues(values);
MyArray.Add(values);
}
Then the secind field in record number 100 would be:
((object[])MyArray[99])[1]
I suppose, the your record numberin begins with 1.
If it begins with 0, then record number and the element index in MyArray
are in sync so:
((object[])MyArray[100])[1]
If you use C#2.0/Visual Studie 2005 (or higher) you should prefer List<>
for ArrayList:
List<object[]> = new List<object[]>();
while (dbReader.Read())
{
object[] values = new object[dbReader.FieldCount];
dbReader.GetValues(values);
MyArray.Add(values);
}
....
MyArray[100][0] //No espl. cast needed here, because Element-Typ of
MyArray is known as object[].
HTH
Christof
}