logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
GetFetch in a loop

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
TroveLord



Joined: 22 Nov 2006
Posts: 136
Location: Italy

PostPosted: Tue Feb 27, 2007 21:44    Post subject: GetFetch in a loop Reply with quote

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
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed Feb 28, 2007 9:48    Post subject: Reply with quote

Use while(SQLFetch()){...}. You can find other examples in the Demo module.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
TroveLord



Joined: 22 Nov 2006
Posts: 136
Location: Italy

PostPosted: Wed Feb 28, 2007 10:49    Post subject: Reply with quote

That worked greatly. Thanks a lot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group