RDLC: (Report Definition Language
Client-side)
Note: First Install Report Viewer in your system.
Step 1: Create database.
Prepare Database tables.
Table 1:
![rdlc]()
Table 2:
![rdlc]()
Table 3:
![rddlc.gif]()
Step 2: Create a Web Application.
Open Visual studio 2010.
Go to file menu select New ->Project.
New Project Window Display in that select ASP.NET Empty Web Application.
Give Application name--RDLC and Click OK.
![rdlc4.gif]()
![rdlc6.gif]()
Step 3: Prepare Dataset
Right click on Application select Add, and again select New Item.
![rdlc7.gif]()
Select dataset and give dataset name (Student Order) and click Add button.
![rdlc8.gif]()
Student Order dataset is prepared in Solution Explorer. Right click on Dataset
and select Open.
![rdlc9.gif]()
Dataset Designer window is display. In that window right click select add and
select Table Adapter.
![rdlc10.gif]()
Table Adapter Configuration Wizard is display. In that click new connection.
![rdlc11.gif]()
Add Connection Window is Display.
- Data Source: Microsoft SQL Server
(SqlClient).
- Server name: Give Local System
name/Server System name.
- Log on to the server: Click Use SQL
Server Authentication Radio button.
- User Name: Give SQL Server
username.
- Password: Give SQL Server
Password.
- Connect to Data base: Click Select
or enter a Database name Radio button. Select/enter your database name in
combo box.
- Test connection: click test
connection button if test connection is successful click ok button.
![rdlc12.gif]()
Click Next in Table Adapter wizard window.
![rdlc13.gif]()
Next check Yes, Save the Connection as check Box. And Connection String Name as
StudentConnectionString. And Click Next button.
![rdlc14.gif]()
Select Use SQL Statements Radio button. And Click Next button.
![rdlc15.gif]()
Next Click Query builder. Add Table Window display. In that select tables one by
one. Finally click close button.
![rdlc16.gif]()
After, In Query builder Window select Particular fields from tables and generate
query.
![rdlc17.gif]()
Click Next Button.
![rdlc18.gif]()
Again Click Next Button.
![rdlc19.gif]()
Finally Click Finish button.
![rdlc20.gif]()
Finally Create Data table with the name as DataTable1.Change Data Table name as
StudentOrderTable.
![rdlc21.gif]()
Finally Save Student Order dataset.
Connection String is created with the name as StudentConnectionString in
web.config file.
![Untitled-36.gif]()
Next Build Entire Solution. I think no errors are found.
Step 4: Design RDLC Report.
First Install ReportViewer in your System.
Create One Folder with name as Reports. Right Click select Add and select new
item.
![rdlc22.gif]()
Select Report Wizard,Give Report Name(StudentOrder) Click Add.
![rdlc23.gif]()
In Solution Explorer Report is generated with the name as StudentOrder in
Reports folder.
Report Wizard window Display.
- Name: Give Dataset name (StudentOrder).
- Data Source : Select Data Source (StudentOrder)
- Available Datasets : select (StudentOrderDataTable)
- Click Next.
![rdlc24.gif]()
Next Arrange Fields.
Drag and Drop required fields from Available fields to Values.
If you want Arrange groups based on any field just drag field from Available
fields to Row Groups. Click Next.
![rdlc25.gif]()
Choose Layouts. Click Next.
![rdlc26.gif]()
Choose Styles. And Click Finish.
![rdlc27.gif]()
Save and Build Solution.
Step 5: Create Web Page.
Create web page With the Name as Student report. And Place Script Manager and
Report viewer.
![rdlc28.gif]()
- Go to Design view, Select Smart tag.
- Click Choose Report Dropdown, Select RDLC
report (StudentReport).
- Click Choose Data Source and select <New
data Source>.
![rdlc29.gif]()
- Select Object and Give DataSource Name.
And Click OK.
![rdlc30.gif]()
Deselect Show Only data components.
Click drop down list select table Adapter.
Finally Click Next.
![rdlc31.gif]()
Click Finish.
![rdlc32.gif]()
Click OK.
![rdlc33.gif]()
Finally Save the Solution and Click Build. In Solution Explorer Select Web Page
(StudentOrder.aspx), Right Click Select Set as Star page and Run application.
![rdlc34.gif]()