Processing Results

    To get results
  1. Get result set information. For more information, see Getting Result Set Information.
  2. If bound columns are used, for each column you want to bind to
  3. For each row in the result set
    1. Call SQLFetch to get the next row.
    2. If bound columns are used, use the data now available in the bound column buffers.
    3. If unbound columns are used, call SQLGetData one or more times to get the data for unbound columns after the last bound column. Calls to SQLGetData should be in increasing order of column number.

      Call SQLGetData multiple times to get data from a text or image column.

  4. Call SQLMoreResults to determine if another result set is available.

    If it returns SQL_SUCCESS, another result set is available.

    If it returns SQL_NO_DATA_FOUND, no more result sets are available.

    If it returns SQL_SUCCESS_WITH_INFO or SQL_ERROR, call SQLError to determine if the output from a PRINT or RAISEERROR statement is available.

    If bound statement parameters are used for output parameters or the return value of a stored procedure, use the data now available in the bound parameter buffers.

    Note that when a result set contains compute rows, each compute row is made available as a separate result set. These compute result sets are interspersed within the normal rows and break up the normal rows into multiple result sets.

  5. Call SQLFreeStmt with an fOption of SQL_UNBIND to release all the bound column buffers.
  6. If another result set is available, go to step 1.