Class :CA.Blocks.DataAccess.DataAccessCore
Namespace :CA.Blocks.DataAccess
Assembly : CA.Blocks.DataAccess.dll
Will execute a value sql query that does not return any results back to the client. This is typically Data modification statements such as insert , update or delete or catalog operations such as creating tables, indexes etc
Will execute a value sql query that does not return any results back to the client. This is typically Data modification statements such as insert , update or delete or catalog operations such as creating tables, indexes etc
Name | Type | Description | |
---|---|---|---|
cmd | System.Data.IDbCommand |
System.Int32
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.
public int IncreasePriceBy10Percent()
{
/// This will Increase all Prices in the product table by 10% and return the number of rows affected
var cmd = CreateTextCommand("update products set price = price * 1.1");
return ExecuteNonQuery(cmd);
}
Although the ExecuteNonQuery returns no rows, any output parameters or return values mapped to parameters are populated with data. This can useful when executing stored procedures.