I am trying to create a procedure that will fill an array with data rows from a SQL query. I am having trouble passing the array. I want to dimension it and then redim to the size of the number of rows. Something like this:
Code: Select all
Procedure.l zExecuteSQLQuery(SQL.s,Array dat(10))
Protected.l hndDB = zOpenSQLDatabase("","")
Protected.l ttlcol,col,count = -1
If IsDatabase(hndDB)
If DatabaseQuery(hndDB,SQL) : Debug SQL
ttlcol = DatabaseColumns(hndDB)
While NextDatabaseRow(hndDB)
count + 1
For col = 0 To ttlcol - 1
dat(count,col) = GetDatabaseString(hndDB,col)
Next col
ReDim dat(count,ttlcol)
Wend
CloseDatabase(hndDB)
EndIf
EndIf
ProcedureReturn count
EndProcedure
Help?
Thanks... DB