Simplify the creation of an IDbCommand object by allowing a stored procedure and optional parameters to be provided

Namespace: CodeSmith.Engine
Assembly: CodeSmith.Engine (in CodeSmith.Engine.dll) Version: 6.0.0.0 (7.0.0.15127)

Syntax

C#
public virtual IDbCommand CreateCommand(
	IDbConnection connection,
	string commandText,
	CommandType commandType,
	params IDataParameter[] commandParameters
)
Visual Basic
Public Overridable Function CreateCommand ( 
	connection As IDbConnection,
	commandText As String,
	commandType As CommandType,
	ParamArray commandParameters As IDataParameter()
) As IDbCommand

Parameters

connection
Type: System.Data..::..IDbConnection
A valid IDbConnection object
commandText
Type: System..::..String
A valid SQL statement
commandType
Type: System.Data..::..CommandType
A System.Data.CommandType
commandParameters
Type: array<System.Data..::..IDataParameter>[]()[][]
The parameters for the SQL statement

Return Value

Type: IDbCommand
A valid IDbCommand object

Examples

 Copy imageCopy
IDbCommand command = helper.CreateCommand(conn, "AddCustomer", "CustomerID", "CustomerName");

See Also