Skip to content

SQLNextResultSet Command

Obsolete

Refer to the SQLNextResultSet method in the cSQLStatement class.

SQLNextResultSet hstmt

The SQLNextResultSet command advances the current result set. This command is used when a statement returns multiple result sets, which can occur when a stored procedure is executed or when a batch of statements is run.

Example

SQLConnect "MSSQLDRV" "SERVER=(local);Trusted_Connection=yes;DATABASE=Order" To hdbc
SQLOpen hdbc To hstmt
SQLExecDirect hstmt "SELECT * FROM salesp; SELECT * FROM orderhea"
Move False To bNoMoreSets

Repeat
    SQLStmtAttribute giHstmt SQLSTMTATTRIB_COLUMNCOUNT To iNumColumns
    If (iNumColumns) Begin
        SQLFetch hstmt
        While SQLResult
            For iCount From 1 To iNumColumns
                SQLGetData hstmt iCount To sColValue
                Show sColValue
                If (iCount < iNumColumns) ;
                    Show ", "
            Loop
            Showln
            SQLFetch hstmt
        Loop
    End

    SQLNextResultSet hstmt
    If (Not(SQLResult)) ;
        Move True To bNoMoreSets
Until bNoMoreSets