SqlHelper..::..ExecuteDataset Method (String, CommandType, String, array<SqlParameter>[]()[][])

Execute a SqlCommand (that returns a resultset) against the database specified in the connection string using the provided parameters.

Namespace:  Core
Assembly:  Core (in Core.dll)

Syntax


public static DataSet ExecuteDataset(
	string connectionString,
	CommandType commandType,
	string commandText,
	params SqlParameter[] commandParameters
)

Parameters

connectionString
Type: String
A valid connection string for a SqlConnection
commandType
Type: CommandType
The CommandType (stored procedure, text, etc.)
commandText
Type: String
The stored procedure name or T-SQL command
commandParameters
Type: array<SqlParameter>[]()[][]
An array of SqlParamters used to execute the command

Return Value

A dataset containing the resultset generated by the command

Exceptions


ExceptionCondition
ArgumentNullExceptionconnectionString

Remarks


e.g.: DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24));