Create RDLC Report in VS 2010 and SQL Server 2008
This article explains how to create a RDLC report using VS 2010 and SQL 2008.
I will create one RDLC report to fetch order details for a given date range.
Please use the following procedure
1. Create a new ASP.NET Empty Project and add a new aspx page named RdlReport.aspx
< ajaxToolkit. ToolkitScriptManager ID ="ScriptManager" runat ="server" AsyncPostBackTimeout ="3600">
</ ajaxToolkit. ToolkitScriptManager >
< div >
</ div >
</ form >
</ body >
</ html >
4. Add a new item:
5. Select Reporting category and the select Report Wizard and click the "Add" button
Considered that the Stored Procedure has already been created to fetch the Order result for a given date.
6. Create a new connection object:
7. Enter the server details:
8. Click on the "Next" button:
9. Set the connection string name and click on the "Next" button:
10. Expand the Stored Procedure node:
11. Select the particular Stored Procedure and click on the "Finish" button:
12. It will list the output columns of the Stored Procedure then click on the "Next" button:
13. Drag the column from the Available fields to the Values block:
Note: Use the Column and Rows groups to grouping column and rows value in the report respectively.
14. All numeric field values are automatically converte to the Aggregate function Sum. So there is a need to manually remove it; just right-click and uncheck
15. Drag the rest of the required columns to be displayed in the report and click on the "Next" button:
16. Select the Layout. The option will be enabled if you use either Row Groups or Column groups.
17. Select the different style and click on the "Finish" button. It will create OrderReport.rdlc and NorthwindDataSet.xsd.
18. Click on "Report Data" (on left side) to add input parameters.
19. Add two parameters for StartDate and EndDate by selecting Data type as Date/Time.
20. Assign the parameter value to the DataSet. Right-click on the Report window and click on "Report Properties".
21. Click on "Variables" and Add a button.
22. Enter the details of the variables. Provide the name StartDate and click on the "fx" button. Click on "Parameters" and select StartDate. Do the same for EndDate.
23. Click on the NorthwindDataSet.xsd. On the windows right-click on "TableAdapter" and click on "Configure".
24. Configure the TableAdpter (by default it will be configured).
Select the Stored Procedure and click on the "Next" button.
Enter the details as in the following:
Click on the "Finish" button.
25. Go to the ASPX and insert the following code for the Start Date and End Date fields:
< table border ="0">
< tr >
< th colspan ="2">Source: www.c-sharpcorner.com