Вы находитесь на странице: 1из 18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio


Compartir

13

Ms

Siguiente blog

Crear un blog

Acceder

Learning ASP.NET
Visit other Blogs on Blogger

BIJU JOSEPH

All about .NET Framework

Sharepoint Consultant

.NET Framew ork 3.5 Architecture The architecture of the .NET


Framew ork version 3.5 and 3.5
Service Pack 1 (SP1) builds upon the
earlier versions of the .NET
Framew ork. .NET Framew ork Vers...
1 year ago

CGI
tbijujoseph@hotmail.com
w +919741600911
m +919741600911
http://just4sharing.com

about me | report abuse

Free C# Code Generator


ironspeed.com
Create database & reporting apps straight from your database! Try it

All about SharePoint 2010


Configuring Window s Azure Access
Control Service (ACS) and Facebook
authentication in SharePoint 2013
Part 2 - This is a tw o part Post w here I
w ill explain how to configure
Window s Azure Access Control
Services and Facebook authentication
in SharePoint 2013. To achi...
3 months ago

Translate

Monday, 16 July 2012

How to do a simple RDLC report using Visual Studio


RDLC (Report Definition Language Client-side)
1. What is RDLC Reporting service?

RDLC stands for Report Definition Language Client-side. RDLC can be run completely client-side in the
ReportViewer control. This removes the need for a Reporting Services instance, and even removes the need for any
database connection whatsoever; but it adds the requirement that the data that is needed in the report has to be
provided manually. RDLC reports do not store information about how to get data. RDLC reports can be executed
directly by the ReportViewer control.
2. RDL VS RDLC
DL files are created by the SQL Server 2005 version of Report Designer. RDLC files are created by the Visual Studio
2008 version of Report Designer.RDL and RDLC formats have the same XML schema. However, in RDLC files, some
values (such as query text) are allowed to be empty, which means that they are not immediately ready to be published
to a Report Server. The missing values can be entered by opening the RDLC file using the SQL Server 2005 version of
Report Designer. (You have to rename .rdlc to .rdl first.).
RDL files are fully compatible with the ReportViewer control runtime. However, RDL files do not contain some
information that the design-time of the ReportViewer control depends on for automatically generating data-binding code.
By manually binding data, RDL files can be used in the ReportViewer control. New! See also the RDL Viewer sample
program.
The ReportViewer control does not contain any logic for connecting to databases or executing queries. By separating
out such logic, the ReportViewer has been made compatible with all data sources, including non-database data
sources. However this means that when an RDL file is used by the ReportViewer control, the SQL related information
in the RDL file is simply ignored by the control. It is the host application's responsibility to connect to databases,
execute queries and supply data to the ReportViewer control in the form of ADO.NET Data Tables.
RDL Much better development experience, more flexibility if you need to use some advanced features like scheduling,
ad-hoc reporting, etc... RDLC (Local reports): Better control over the data before sending it to the report (easier to
validate or manipulate the data prior to sending it to the report). It has much easier deployment and no need for an
instance of Reporting Services.
One HUGE drawback with local reports is a known memory leak that can severely affect performance if your clients will
be running numerous large reports. This is supposed to be addressed with the new VS2010 version of the report viewer.
3. How to create a RDLC report in VS 2008?

Step1: Creating Client Report Definition (.rdlc) Files.


There are many ways for creating rdlc files. Follow any of these methods for creating rdlc file Create a new client
report definition (.rdlc) file in Visual Studio. Convert an existing RDL file to rdlc or create rdlc file programmatically. I
am dealing here only on creating new rdlc from VS.
Select Add new item and select report/report wizard

Topics

ASP.NET (3)
BASICS (1)
DIRECTIVES (1)
INTERVIEW QUESTIONS (1)
Mail (1)
Mail Settings (1)
PAGES (1)
RDL (1)
RDLC (1)
Reporting in .NET (1)
SMTPClient (1)
VIEW STATE (1)

Search Am azon Products


Search A mazon.in:

Amazon.in
Keywords:

Visit m y personal site

Creating and accessing Queue in


Windows Azure - 4/2/2014 - biju
joseph

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

1/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio


available Office 365 web
templates - 1/2/2014 - biju joseph
Apps for SharePoint Side
Presentation - 27/1/2014 - biju
joseph
How to creating Provider-hosted
apps for SharePoint
2013 - 27/1/2014 - biju joseph
Loading custom web parts
asynchronously in SharePoint
2010 - 14/1/2014 - biju joseph

Blog Archive

2013 (1)
2012 (4)
July (4)
How to do a simple RDLC report
using Visual Studio...
Reading MailSetting from
web.config
Understanding ASP.NET Basics
Questions normally asked in
ASP.NET Interviews

Selecting report will add an empty rdlc file whereas wizard will lead you to create a report with data connection.

Subscribe To

Posts
Comments

View s

35,918

MyReport.rdlc is added to the solution explorer.


IF you are using report wizard, follow the following steps..

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

2/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Live Traffic Feed

A visitor from Mexico, Distrito


Federal viewed "Learning
ASP.NET: How to do a simple
RDLC report using Visual Studio"
A visitor from Montral, Quebec
3 mins ago
viewed "Learning ASP.NET: How
to do a simple RDLC report using
Visual
Studio"
57 mins Punjab
ago
A
visitor
from Lahore,
viewed "Learning ASP.NET: How
to do a simple RDLC report using
Visual
Studio"
1 hr 25 mins
A
visitor
from Istanbul
left ago
"Learning ASP.NET: How to do a
simple RDLC report using Visual
Studio" via msdn.microsoft.com 2
A
from
Istanbul left
hrsvisitor
32 mins
ago
"Learning ASP.NET: How to do a
simple RDLC report using Visual
Studio" via aspalliance.com 2 hrs
A
from Istanbul left
33visitor
mins ago
"Learning ASP.NET: How to do a
simple RDLC report using Visual
Studio" via ssw.com.au 2 hrs 33
A
visitor
mins
ago from Istanbul left
"Learning ASP.NET: How to do a
simple RDLC report using Visual
Studio" via msdn.microsoft.com 2
A
from
Istanbul viewed
hrsvisitor
34 mins
ago
"Learning ASP.NET: How to do a
simple RDLC report using Visual
Studio"
hrs 36
mins ago
A
visitor2from
Jakarta,
Jakarta
Raya viewed "Learning ASP.NET:
How to do a simple RDLC report
using Visual Studio" 2 hrs 40 mins
A
agovisitor from Faisalabad, Punjab
viewed "Learning ASP.NET: How
to do a simple RDLC report using
Visual
Studio"
53 mins ago
Real-time
view2 hrs
Menu

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

3/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Create connection string

Save connection string to web.config file

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

4/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Choose your stored procedure/table/query

Add fields to the report

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

5/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Complete the wizard

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

6/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio


Step2: Creating a dataset.
Select add new item to add a dataset to the project

Add the new dataset to the app_code folder

Step3: Drag Table Adapter & Use the configuration wizard to configure the dataset.

Select connection string

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

7/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Select one from the options given

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

8/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Solution explorer updated with dataset


Instead of dataset you can also use object DataSource as data source of rdlc file.
Step4: Adding DataSource to Report
Open rdlc file in the design view, Click on Show data sources under the Data menu item and you
can simply drag and drop fields to the report.

Drag and drop a table from tool box.

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

9/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Click on ReportsData sources to add data sources to the report

Drag and drop the fields you wanted on the detail section of the table.

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

10/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Add footer if need.

Place whatever controls you want on the report and drag field to its expression

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

11/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

You have a couple of categories from which you can have data for the expression.
Under global we have:

Under parameter we have all the parameters you have added to the report.

Step5: Adding Parameters to Report


To communicate between the UI and the report, use parameters.
To add parameter use Reports-> report parameters menu item

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

12/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Rdlc file and the dataset are ready and we can show the report in the web page. You can set the page
properties using Report properties dialog

Step6: Adding rdlc on aspx page


Add a new aspx page and drag a report view control on it. Use the smart tag to choose report. Once
you add the report,
Report source as well can be configured.

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

13/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Step7: Run the web page and you will be able to view the report.

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

14/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio

Step8: How to attach DataSource dynamically from C# to rdlc file

Step9: How initialize parameters from C# to rdlc file


// parameters are initialized for the report
ReportParameter Param0 = new ReportParameter("fromDate", fromDate.ToString(dateFormat));
ReportParameter Param1 = new ReportParameter("toDate", toDate.ToString(dateFormat));
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Param0, Param1 });

Step9: Deployment Note.


1. Add the following key to handler section of the web.config file
<handlers>

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

15/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio


<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd"
verb="*" type="Microsoft.Reporting.WebForms.HttpHandler,Culture=neutral" resourceType="Unspecified"/>
</handlers>

2. You may get this error Server Error in '/' Application.


Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=8.0.0.0' or one of its dependencies.
The system cannot find the file specified.. To solve this mannually copy the following files to the bin folder of your
website.
Please make sure you have .NET Framework 3.5 installed on the computer.
When you run ReportViewer.exe, the following files are installed in the Global Assembly Cache folder on the
deployment computer.
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.WinForms.dll
Microsoft.ReportViewer.DataVisualization.dll
The error indicates that the system cannot load Microsoft.ReportViewer.Webforms. Please try to manually copy
the Microsoft.ReportViewer.WebForms.dll file to the application folder /bin directory. Please refer to the following
link for more information about the Report Viewer.
http://msdn.microsoft.com/en-us/library/ms251723.aspx
3. If you are publishing the webstie using framework 3.5 use Allow this precompiled site to be updatable.

I found the following sites to be very useful while working with RDLC reporting
http://www.ssw.com.au/ssw/standards/rules/rulestobetterSQlreportingservices.aspx
http://aspalliance.com/articleViewer.aspx?aId=914&pId=-1
http://msdn.microsoft.com/en-us/library/xt50s8kz.aspx
http://technet.microsoft.com/en-us/library/ms157328.aspx
Biju Joseph

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

16/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio


Posted by Biju Joseph at 21:29

+13 Recomendar esto en Google

Labels: RDL, RDLC, Reporting in .NET

10 comments

Add a comment

Top comments

prathap kumar 5 months ago - Shared publicly


Thanks for your detailed description on RDLC.
prathap
http://wisentechnologies.com/it-courses/.net-training.aspx
1 Reply

Sandeep Tripathi 6 months ago - Shared publicly


How to convert RDLC report in .txt format
1 Reply

Biju Joseph 6 months ago


Sorry, I don't have much idea about converting rdlc to txt.

BHASKAR BANERJEE 6 months ago - Shared publicly


very nice
+1
2
1

1 Reply

ravikumar g 5 months ago - Shared publicly


In found a good example to generate rdlc reports in asp.net
http://www.dotnetsharepoint.com/2013/09/how-to-create-rdlc-reports-inaspnet.html#.UjhuoMafh88
+1
2
1

1 Reply

kootes balu 4 months ago


thank u god bless u brother

ankesh kumar 3 months ago - Shared publicly


Thanks for details describe about RDLC Report
+1
2
1

1 Reply

aShFak M 8 months ago


One more thing can i write more then one SQL Query in single Store Procedure...n call the same SP to
Execute different Queries..

aShFak M 8 months ago


Thank You Mr Biju its very Useful to New Comers.......... I also Learned lot by this. just have to
implement

Anand Parmar 10 months ago


very helpfull

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

17/18

17/2/2014

Learning ASP.NET: How to do a simple RDLC report using Visual Studio


Newer Post

Home

Older Post

Subscribe to: Post Comments (Atom)

Simple Project Template


sm artshe e t.com
Ye s. It's e asy. Nothing to install. Try it Fre e !

Google+ Follow ers

Biju Joseph
Add to circles

12 have me in circles

View all

Simple template. Powered by Blogger.

http://myaspdotnettrainings.blogspot.mx/2012/07/rdlc-report-definition-language-client.html

18/18

Вам также может понравиться