dbcount

DB Library for C

DB Library for C

dbcount

Returns the number of rows affected by a Transact-SQL statement.

Syntax

DBINT dbcount ( PDBPROCESS dbproc );

Arguments

dbproc

Is the DBPROCESS structure that is the handle for a particular workstation or Microsoft® SQL Server™ 2000 process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.

Returns

The number of rows affected by the current statement. Call dbiscount to determine if this count is correct.

Remarks

After the results of a statement have been processed, you can call dbcount to find out how many rows were affected by the statement. For example, if a SELECT statement was sent to SQL Server and you have read all the rows by calling dbnextrow until it returned NO_MORE_ROWS, you can call DBCOUNT to find out how many rows were retrieved.

If the current statement doesn't immediately return rows (for example, a DELETE statement), you can call dbcount after dbresults.

If the current statement executes a stored procedure, for example an EXEC or a call to a remote stored procedure, dbcount reports the number of rows returned by the last SELECT statement executed by the stored procedure. Note that a stored procedure without a SELECT statement can execute a SELECT simply by calling another stored procedure with a SELECT statement.

See Also

dbnextrow

dbresults

DB-Library Options