db_rows

Returns the number of rows affected by the last INSERT/UPDATE/DELETE operation on the current database connection.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X X X

Syntax

int db_rows()

Description

Returns the number of rows affected by the last INSERT/UPDATE/DELETE database operation. If no error occurred, this value is the same as that returned by exec_sql(). If an error occurs during a bulk database operation, this value indicates how many INSERT/UPDATE/DELETEs were performed prior to the error.

Example

Performs a bulk insert into a table using a list. Reports how many rows were actually inserted.
if (trap( { exec_sql("insert into staff values (:1)",L1); } ))
  prompt("Insert failed after " ^^ db_rows() ^^ " rows");
else prompt(db_rows() ^^ " were inserted successfully");