Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Faster way to fill Array with ADO recordset
Message
From
25/10/2002 04:35:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/10/2002 00:45:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00715267
Message ID:
00715308
Views:
11
>Hi all,
>
>Is there a faster way to fill a array from an ADO recordset than that,
>
>.oRS1=.oConnect.Procura_Geral(lcTable)
>DIMENSION .combobox1.aItems[.oRS1.RecordCount,2]
>.oRS1.MoveFirst
>FOR lni = 1 TO .oRS1.RecordCount
>	.combobox1.aItems[lni,1] = .oRS1.Fields('c_codigo').value
>	.combobox1.aItems[lni,2] = .oRS1.Fields('c_descri').value
>	.oRS1.MoveNext
>NEXT lni
>
>
>Thank's
>
>João Batista

João,
Check GteRows() method of ADO.Recordset
DIMENSION arrFields[2]
arrFields[1]='c_codigo'
arrFields[2]='c_descri'
myArray = oRecordset.GetRows(,,@arrFields)
However be carefull it fills the array by columns. ie:
Row 5, c_codigo and c_descri is not myArray[5,1] and myArray[5,2] but :
myArray[1,5] and myArray[2,5] && Swap row and col pointers
I think still transforming this array to array[row,col] is faster.

BTW, if ADO is not a must SQLExec() and copy to array combination might be cheaper and faster.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform