ADO Recordset Getrows

Hi,

I'm having trouble using the GetRows method of ADODB.Recordset. I have a SELECT statement which I execute. I read the resulting records into an array using GetRows(-1). I know that the 3rd field in the recordset is the one I want to do some processing on. I have a For..Next loop which I use to process each record. My problem is that I don't know how to get the UBound of the array so I can't set my loop properly. Here is the code I'm using:

cn.Open "DSN=TEST"
sSQL = "Select * From TestTable"
Set rs = cn.Execute(sSQL)
vResults = rs.GetRows(-1)

For lCounter = 0 To UBound(vResults(2), 2)
vResults(2, lCounter) = CStr(vResults(2, lCounter))
vResults(8, lCounter) = AdAPI.Decrypt(CStr(vResults(8, lCounter)))
Next lCounter

I have tried many variations of the code in red but I always get a 'Subscript out of range' error. What is the correct code to set up the loop?

Thanks very much,

PinkMoon
[1019 byte] By [PinkMoon] at [2007-11-19 14:09:23]
# 1 Re: ADO Recordset Getrows
Try to Redim Preserve your vresults array before you get ubound
Sabin_33 at 2007-11-9 20:28:47 >