Get Update Count

Determines the number of rows affected by the last write operation to the database.

Inputs

Database connection
A CwDBConnection object that represents the database connection.

Output

Returns an integer that specifies the number of rows affected by the last write operation.

Exceptions

The Get Update Count function block can throw the CwDBConnectionException exception if a database error occurs.

Notes

The Get Update Count function block indicates how many rows have been modified by the most recent update operation in the database associated with the current connection. This function block is useful after you send an

UPDATE or INSERT statement to the database and you want to determine the number of rows that the SQL statement has affected.

Important

Before using this method, you must create a CwDBConnection object with the Get Database Connection function block and send a query that updates the database with one of the following function blocks:

  • Execute SQL
  • Execute SQL with Parameter
  • Execute Prepared SQL
  • Execute Prepared SQL with Parameter

Related information

This function block is based on the CwDBConnection.getUpdateCount() method. For more information, see getUpdateCount().

Copyright IBM Corp. 2004