Hi Group,
I had a function that was running slow. It was suggested that I use the GetRows method which I've now used and it is much quicker.
However, I have a couple of issues:
1. How do I redim the array
When I use the following line:Redim arrData(irows, icols) , the process is slow again. When I use: Redim allData(irows, icols) I get an error saying that it is not supported.
2. How do I check for EOF or BOF?
I receive this error if there are no records returned by the query:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.
Here is my code:
Public function CreateArray(arrData, icols)
'Creates an array from the SQL property and the currect connection property
Dim rst, irows
'Default the rows to zero
irows = 0
'Create the recordset
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open SQLString,Connection,3
allData=rst.GetRows
'Check to see if any data is in the recordset
irows=ubound(allData,2)
icols=ubound(allData,1)
*****Redim arrData(irows, icols) ****
do while not rst.eof
irows=0
for rowcounter = 0 to irows
for colcounter=0 to icols
allData(rowcounter,colcounter)=Cstr(rst.fields(col counter).Value)
next
next
loop
set rst = nothing
CreateArray = irows
end function