Execute an IDbCommand (that returns a resultset) against the specified IDbConnection
using the provided parameters.
Namespace: CodeSmith.EngineAssembly: CodeSmith.Engine (in CodeSmith.Engine.dll) Version: 6.0.0.0 (7.0.0.15127)
Syntax
| C# |
|---|
public virtual DataSet ExecuteDataset( IDbConnection connection, CommandType commandType, string commandText, params IDataParameter[] commandParameters ) |
| Visual Basic |
|---|
Public Overridable Function ExecuteDataset ( connection As IDbConnection, commandType As CommandType, commandText As String, ParamArray commandParameters As IDataParameter() ) As DataSet |
Parameters
- connection
- Type: System.Data..::..IDbConnection
A valid IDbConnection
- commandType
- Type: System.Data..::..CommandType
The CommandType (stored procedure, text, etc.)
- commandText
- Type: System..::..String
The stored procedure name or SQL command
- commandParameters
- Type: array<System.Data..::..IDataParameter>[]()[][]
An array of IDataParameters used to execute the command
Return Value
Type: DataSetA DataSet containing the resultset generated by the command
Examples
DataSet ds = helper.ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders", new IDataParameter("@prodid", 24)); | |
Exceptions
| Exception | Condition |
|---|---|
| System..::..InvalidOperationException | Thrown if any of the IDataParameters.ParameterNames are null, or if the parameter count does not match the number of values supplied |
| System..::..ArgumentNullException | Thrown if commandText is null |
| System..::..ArgumentException | Thrown if the parameter count does not match the number of values supplied |
| System..::..ArgumentNullException | Thrown if connection is null |