SQLBat

MAY Computer

Help

GOTONEXTROW

Applies to  

SQLBat (Module: SQLBatX.dll)

Group  

Processing

See also  

LOOPSQLRESULTS, READROW, VIEWROW

After an SQL query (SELECT) statement has been performed on an open database connection and you can loop through the found rows with this command. With this method you jump to the next record but the record is NOT read immediately into row values. You have to use the READROW command to read row data.

When using LOOPSQLRESULTS method to loop through records then do NOT use this method because LOOPSQLRESULTS itself already performs a movenext operation!

 

Syntax

[GOTO]NEXTROW  <VariableName>[, <ConnectionKey>]

Part

Description

<VariableName> Name of a script variable where the method stores a 0 (no more record) or 1 (moved to next record successfully).
<ConnectionKey> A shortname to identify the database connection for which the option is set. It can be omitted if you have previously specified the ConnectionKey once before.

 

 

Sample

SUB MAIN
  DEBUGMODE ON
  USINGDB Mydb
  SETMDBODBCCONSTR "C:\Test.mdb"
  CONNECT
  OPENQUERY "SELECT * FROM test", Rows
  MSGBOX %SCR.Rows%
  WHILE 1 = 1   
    READROW
    VIEWROW
    GOTONEXTROW r
    IF %SCR.r% = 0 THEN EXITLOOP
  WEND
  CLOSEQUERY
  DISCONNECT
END SUB