We need to follow following steps to generate simple report with RDLC:
1. Create RDLC file.
2. Create Dataset from Report Data Source.
3. Design the Report
4. Runtime pass information to Report Data Source, so report will be generated with Data
Let's create one simple web application with RDLC report.
1. Create RDLC file:
2. Create Dataset from Report Data Source:
3. If your "Data Source" is listed in options, select it from there, else click on "New".
4. If your "Connection" is listed in options, select it from there, else click on "New Connection", to make your connection.
5. Once "Connection" is selected, select your Table/View/Stored Procedure/Function, from which you need to build your report and give an appropriate name to Dataset:
6. Once you have selected DB Object in Dataset, you can find out all the columns that are available in selected dataset as follows:
7. Once you have this dataset, you will also find that one XSD file is also created in App_code folder, with the same schema, which is used to provide schema definition to RDLC file
3. Design the RDLC Report:
In Step #2, we have created Dataset with columns that needs to be displayed on the report. Now its time to use that Dataset and design the report.
You should drag, "Table" from "Toolbox" and assign property "Dataset" created Dataset in Step #2.
4. Runtime pass information to Report Data Source, so report will be generated with Data:
So far, we have done report designing, now its time to pass actual data to the Report Data Source, so report will be generated with actual Data. To display report on the browser, we have to use "Microsoft Reporting WebForms", which will load the report in the browser with ASPX page. Please follow the steps to pass information to RDLC Report:
Let me explain how it works:
1. On Page load, we call one stored procedure to get data from database. Here I have used Microsoft Application block to connect to database and get the information
2. Once, we have the data in DataSet, we have created new "Report Data Source" with the SAME name: "Dataset1" and assign result table as per #1 and assign it to ReportViewer
3. And at last we refresh ReportViewer to display the information as per Datasource provided.
This report is ready and you can export it in Excel, PDF, Word etc. This example is developed in Microsoft Visual Studio 2010
Let me know your comments and difficulties, if any
Posted by Tejas Shah on November 22, 2017
Posted by Tejas Shah on November 11, 2017
Posted by Tejas Shah on August 12, 2015
Posted by Tejas Shah on June 26, 2015
Posted by Tejas Shah on April 20, 2015