SqlHelper..::..ExecuteNonQueryAsync Method (String, CommandType, String, array<SqlParameter>[]()[][])

Execute a SqlCommand (that returns no resultset) against the database specified in the connection string using the provided parameters

Namespace:  Core
Assembly:  Core (in Core.dll)

Syntax


public static Task<int> ExecuteNonQueryAsync(
	string connectionString,
	CommandType commandType,
	string commandText,
	params SqlParameter[] commandParameters
)

Parameters

connectionString
Type: String
A valid connection string for a SqlConnection
commandType
Type: CommandType
The CommandType (stored procedure, text, etc.)
commandText
Type: String
The stored procedure name or T-SQL command
commandParameters
Type: array<SqlParameter>[]()[][]
An array of SqlParamters used to execute the command

Return Value

An int representing the number of rows affected by the command

Exceptions


ExceptionCondition
ArgumentNullExceptionconnectionString

Remarks


e.g.: int result = ExecuteNonQueryAsync(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));