Simplify the creation of an IDbCommand object by allowing
a stored procedure and optional parameters to be provided
Namespace: CodeSmith.EngineAssembly: CodeSmith.Engine (in CodeSmith.Engine.dll) Version: 6.0.0.0 (7.0.0.15127)
Syntax
C# |
---|
public virtual IDbCommand CreateCommand(
string connectionString,
string spName,
params string[] sourceColumns
) |
Visual Basic |
---|
Public Overridable Function CreateCommand (
connectionString As String,
spName As String,
ParamArray sourceColumns As String()
) As IDbCommand |
Parameters
- connectionString
- Type: System..::..String
A valid connection string for an IDbConnection
- spName
- Type: System..::..String
The name of the stored procedure
- sourceColumns
- Type: array<System..::..String>[]()[][]
An array of string to be assigned as the source columns of the stored procedure parameters
Return Value
Type:
IDbCommandA valid IDbCommand object
Examples
| Copy |
---|
IDbCommand command = helper.CreateCommand(conn, "AddCustomer", "CustomerID", "CustomerName"); |
Exceptions
See Also