Creates an appropriate IDbCommand and executes a statement against the connection.

Namespace: System.Extensions.Data
Assembly: System.Extensions (in System.Extensions.dll) Version: 0.0.0.5 (0.0.0.5)

Syntax

C#
public static int ExecuteCommandNonQuery(
	this IDbConnection connection,
	string commandText,
	CommandType commandType
)
Visual Basic
<ExtensionAttribute> 
Public Shared Function ExecuteCommandNonQuery ( 
	connection As IDbConnection,
	commandText As String,
	commandType As CommandType
) As Integer
Visual C++
public:
[ExtensionAttribute]
static int ExecuteCommandNonQuery(
	IDbConnection^ connection, 
	String^ commandText, 
	CommandType commandType
)
F#
static member ExecuteCommandNonQuery : 
        connection : IDbConnection * 
        commandText : string * 
        commandType : CommandType -> int 

Parameters

connection
Type: System.Data..::..IDbConnection
The connection to execute the command against.
commandText
Type: System..::..String
The text of the command to execute.
commandType
Type: System.Data..::..CommandType
The type of the command to execute.

Return Value

Type: Int32
The number of rows affected.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDbConnection. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also