Executes an SQL statement and returns the number of rows affected.
public int ExecuteNonQuery();
You can use the ExecuteNonQuery to execute statements that do not return result sets (e.g., UPDATE, INSERT, DELETE, etc.).
Although the ExecuteNonQuery does not return any rows, any stored procedure output parameters mapped to AdsParameter objects are still populated with data.
For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1.
// create a connection object
AdsConnection conn = new AdsConnection( "data source = c:\\data;" );
// open the connection
// create a new command object
cmd = new AdsCommand( "update departments set budget = budget * 1.05",
// execute the query
Console.WriteLine( "Records affected: " + cmd.ExecuteNonQuery() );