Creates and returns a IDbCommand object associated with 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 IDbCommand CreateCommand(
	this IDbConnection connection,
	string commandText,
	CommandType commandType
)
Visual Basic
<ExtensionAttribute> 
Public Shared Function CreateCommand ( 
	connection As IDbConnection,
	commandText As String,
	commandType As CommandType
) As IDbCommand
Visual C++
public:
[ExtensionAttribute]
static IDbCommand^ CreateCommand(
	IDbConnection^ connection, 
	String^ commandText, 
	CommandType commandType
)
F#
static member CreateCommand : 
        connection : IDbConnection * 
        commandText : string * 
        commandType : CommandType -> IDbCommand 

Parameters

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

Return Value

Type: IDbCommand
An IDbCommand object associated with the connection.

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