Execute a stored procedure via an IDbCommand (that returns a resultset) against the database specified in
the connection string using the provided parameter values. This method will query the database to discover the parameters for the
stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
Namespace: CodeSmith.EngineAssembly: CodeSmith.Engine (in CodeSmith.Engine.dll) Version: 6.0.0.0 (7.0.0.15127)
Syntax
C# |
---|
public virtual DataSet ExecuteDataset( string connectionString, string spName, params Object[] parameterValues ) |
Visual Basic |
---|
Public Overridable Function ExecuteDataset ( connectionString As String, spName As String, ParamArray parameterValues As Object() ) As DataSet |
Parameters
- connectionString
- Type: System..::..String
A valid connection string for an IDbConnection
- spName
- Type: System..::..String
The name of the stored procedure
- parameterValues
- Type: array<System..::..Object>[]()[][]
An array of objects to be assigned as the input values of the stored procedure
Return Value
Type: DataSetA DataSet containing the resultset generated by the command
Remarks
This method provides no access to output parameters or the stored procedure's return value parameter.
Examples
Copy | |
---|---|
DataSet ds = helper.ExecuteDataset(connString, "GetOrders", 24, 36); |
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | Thrown if connectionString is null |
System..::..ArgumentNullException | Thrown if spName is null |