Sdílet prostřednictvím


SQLRowCount

When arrays of parameter values are bound for statement execution, SQLRowCount returns SQL_ERROR if any row of parameter values generates an error condition in statement execution. No value is returned through the RowCountPtr argument of the function.

The application can take advantage of the SQL_ATTR_PARAMS_PROCESSED_PTR statement attribute to capture the number of parameters processed prior to the error occurring.

Further, the application can use an array of status values, bound by using the SQL_ATTR_PARAM_STATUS_PTR statement attribute, to capture the array offsets of offending parameter rows. The application can traverse the status array to determine the actual number of rows processed.

When a Transact-SQL INSERT, UPDATE, DELETE, or MERGE statement with an OUTPUT clause is executed, SQLRowCount will not return the count of rows affected until all the rows in the result set generated by the OUTPUT clause have been consumed. To sconsume these rows, you call SQLFetch or SQLFetchScroll. SQLResultCols will return -1 until all result rows have been consumed. After SQLFetch or SQLFetchScroll returns SQL_NO_DATA, the application must call SQLRowCount to determine the number of rows affected before calling SQLMoreResults to move to the next result.

See Also

Concepts

Other Resources