View previous topic :: View next topic |
Author |
Message |
TroveLord
Joined: 22 Nov 2006 Posts: 136 Location: Italy
|
Posted: Tue Feb 27, 2007 21:44 Post subject: GetFetch in a loop |
|
|
Hi,
I can't figure out how to move to next row with GetFetch in a FOR loop
e.g. I have this code
Code: | SQLExecDirect("SELECT COUNT(*) FROM some")
int count = StringToInt(SQLGetData(1));
int i, k;
string sString;
SQLExecDirect("SELECT this, that FROM some");
for(i = 1, i < count; i++)
{
sString += SQLExecDirect("this: "+SQLGetData(++k)+", that: "+SQLGetData(++k));
} |
Now where should I put SQLFetch("NEXT"); ?
I tried just before closing the for statement but it doesn't work, any idea?
Thanks |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Wed Feb 28, 2007 9:48 Post subject: |
|
|
Use while(SQLFetch()){...}. You can find other examples in the Demo module. |
|
Back to top |
|
|
TroveLord
Joined: 22 Nov 2006 Posts: 136 Location: Italy
|
Posted: Wed Feb 28, 2007 10:49 Post subject: |
|
|
That worked greatly. Thanks a lot. |
|
Back to top |
|
|
|