Product Documentation

c-treeACE V11.0 Update Guide

Previous Topic

Next Topic

Returning a Result Set from a Stored Procedure

A stored procedure may return a result set. In this case you must add columns to the result set row and then add the row to a result set.

This is accomplished as shown below:

  1. Create an instance of the SqlSpResulsetRow class by invoking the NewResultSetRow() method.

    SqlSpRow RSrow = NewResultSetRow();

  2. Set column values in a result set using the column index. For easier code writing, the generated code contains constants with the name of the result set columns and the values are the column indexes.

    RSrow[RSCol.mycolumn].Value = "";

  3. Add the row using ResultSetAddRow(SqlSpRow RSrow). Notice that this method creates a copy of the row, so the SqlSpRow object can be reused for additional rows.

A stored procedure may also have OUT parameters that must be set before returning. This is enforced by the C# language as the ExecuteSP prototype implements “out” for OUT parameters.

A stored procedure may also have INOUT parameters that may or may not be set before returning. In this case the ExecuteSP prototype implements “ref” for INOUT parameters.

TOCIndex