Instead of rolling your own, look at the .GetRows method.
To put some code behind my claim:
Dim oTCN : Set oTCN = CreateObject( "ADODB.Connection" )
Dim sTDir : sTDir = "M:\lib\kurs0705\testdata\txt" ' <-- ohne \ am Ende!
Dim sCS : sCS = Join( Array( _
"Provider=MSDASQL" _
, "Driver={Microsoft Text Driver (*.txt; *.csv)}" _
, "DBQ=" & sTDir _
), ";" )
oTCN.Open sCS
Dim oRS
Set oRS = oTCN.Execute("SELECT TOP 3 * FROM [gendata.txt]")
Dim nUB : nUB = oRS.Fields.Count - 1
ReDim aRow(nUB) ' array for one row
ReDim aRows(nUB, -1) ' 2nd dim growable array for all rows
Dim f
For f = 0 To UBound(aRow)
aRow(f) = oRS.Fields(f).Name
Next
WScript.Echo Join(aRow, ",")
Do Until oRS.EOF
ReDim Preserve aRows(nUB, UBound(aRows, 2) + 1)
For f = 0 To UBound(aRow)
aRow(f) = oRS.Fields(f).Value
aRows(f, UBound(aRows, 2)) = oRS.Fields(f).Value
Next
WScript.Echo Join(aRow, ",")
oRS.MoveNext
Loop
oRS.MoveFirst
Dim aMagic : aMagic = oRS.GetRows() ' this is all you need!
Dim r, c
For r = 0 To UBound(aMagic, 2)
For c = 0 To UBound(aMagic, 1)
WScript.Echo r, c, aMagic(c, r), aRows(c, r)
Next
WScript.Echo
Next
oTCN.Close
output:
=============================================================
iID,sFrsName,sLstName,sSex,dtBirth
1,Yqiqpbcmunrzvi,Pmyqcxfoffrfnwbd,U,8/7/2008
2,Viyvfshpxu,Xjtfbjuiiwojhyjwkefcu,U,7/27/2008
3,Hoocyseiiiawrt,Mrpuhzuhysslzhwhnpp,F,8/7/2008
0 0 1 1
0 1 Yqiqpbcmunrzvi Yqiqpbcmunrzvi
0 2 Pmyqcxfoffrfnwbd Pmyqcxfoffrfnwbd
0 3 U U
0 4 07.08.2008 07.08.2008
1 0 2 2
1 1 Viyvfshpxu Viyvfshpxu
1 2 Xjtfbjuiiwojhyjwkefcu Xjtfbjuiiwojhyjwkefcu
1 3 U U
1 4 27.07.2008 27.07.2008
2 0 3 3
2 1 Hoocyseiiiawrt Hoocyseiiiawrt
2 2 Mrpuhzuhysslzhwhnpp Mrpuhzuhysslzhwhnpp
2 3 F F
2 4 07.08.2008 07.08.2008
=============================================================
So - contrary to Ansgar's "You can't use ReDim Preserve on multidimensional arrays" - you can grow the last dimension of an multidimensional array. That means you have to grow the rows and layout your array in a col/row instead of the more 'natural' row/col structure.
aRows shows how you roll your own .GetRows correctly. Of course the sane strategy is to use, as in
Dim aMagic : aMagic = oRS.GetRows() ' this is all you need!