Sunday, 7 June 2020

Adding Parameters to SSRS Report

This article explains how to add parameters to a SQL Server Reporting Service (SSRS) including how to create a new SSRS report and how to write a query with parameters. Okay let's start.
 
Step 1: Open your SQL Server Reporting Tools.

Select "File" -> "New" -> "Project..." then provide your project name and then click the 'OK' button.

Sql Server Reporting Tools

Step 2: Here is the Report Wizard page; you should continue.

Report Wizard page

Step 3: Connect to your database. First click the "Edit" button.

connect your database

Step 4:

  1. Choose your server name.
  2. To connect to your database use Windows Authentication or use SQL Server Authentication. I prefer Windows Authentication.
  3. Connect to the database you want to use, choose it from the ComboBox.
  4. Number 3 is optional.
  5. Click the 'OK' button.

Choose your server name

Step 5:
 All of the configuration exists. If you want you can update your connection settings from there.

update your connection settings
 
Step 6: We should write a new SQL query.

write a new SQL query

Step 7: In this step you can choose your table type.

choose your table type

Step 8:

Design the table

Step 9:

Choose the table style

Step 10: Write your Report Name and the result will be produced.

Report Result

Step 11: Now I need a parameter. Create a new dataset.

Create a new Datasets

Right-click then seelct "Add DataSet" then choose the dataset to be embedded in the report.

Add DataSet in Report

Step 12: Write your query with parameters.

Query with paremeters

Step 13:

DataSet Property

Step 14: Now when you execute this query you see a TextBox. Write the product name and click "View Report".

View Report

No comments:

Post a Comment