Stored Procedure as Dataset
In This Topic
A stored procedure is a group of SQL statements that encapsulate a set of operations or queries to execute on a database.
Follow the below steps to add a parameterized stored procedure as a data set.
- First, Connect to OLEDB Data Source (here we will connect to Reels.mdb).
-
In the Report Explorer, right-click the data source node and select the Add Data Set option or select Data Set from the Add button.
- In the Add Dataset that appears, select the General page and enter the name of the dataset as 'SalesDataForStore'. This name appears as a child node to the data source icon in the Report Explorer.
- On the Query page of this dialog, set the Command Type to 'StoredProcedure'.
- In the Query field, enter the stored procedure name (e.g. SalesDataForStore).
- Click the Validate icon to validate the query.
Note: You may get an error at this point since the required parameters have not yet been added.
- Go to the Parameters page and add a Parameter using the Add(+) button.
- On the same page, enter Name as StoreID and Value as 1002.
- Select the Query page of DataSet dialog, and click the Validate icon to validate the query and load the fields.
- Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.