Dotnet-Project Framework documentation.

GenericDataHelper.ExecuteReader Method (IDbConnection, String, Object[])

Execute a stored procedure via a Command (that returns a resultset) against the database 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.

public static IDataReader ExecuteReader(
   out IDbConnection aConnection,
   string spName,
   params object[] parameterValues
);

Parameters

aConnection
The connection used and that you must close.
spName
The name of the stored procedure
parameterValues
An array of objects to be assigned as the input values of the stored procedure

Return Value

A DataReader containing the resultset generated by the command

Remarks

This method does not close the connection created. You must close the connection when you have finished to work with the reader.

Example

This method provides no access to output parameters or the stored procedure's return value parameter.

IDbConnection connection = null;
SqlDataReader dr = (SqlDataReader)ExecuteReader(out connection, spName, "GetOrders", 24, 36);
/* Do work */
dr.Close();
dr.Dispose();
connection.Close();

See Also

GenericDataHelper Class | DotnetProject.Data Namespace | GenericDataHelper.ExecuteReader Overload List