100% found this document useful (1 vote)
242 views

How To Do A Simple RDLC Report Using Visual Studio

coding with vb.net
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
242 views

How To Do A Simple RDLC Report Using Visual Studio

coding with vb.net
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

[email protected] (MAILTO:BIJU@JUST4SHARING.

COM) +919741600911
Welcome Guest [ Log In (../../Account/Login.aspx) ]

Member Since 5/1/2012


biju joseph ()
() Published: 2/27/2013
Views: 53753| Comments ()

RDLC (Report Definition Language Client-side)

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.
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.
How to create a RDLC report in VS 2008?
Step 1: 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


Selecting report will add an empty RDLC file whereas wizard will lead you to create a report with data connection.
If you are using report wizard, follow the following steps..
Creating connection string
Save connection string to web.config file
Choose your stored procedure/table/query

Add fields to report


Complete the wizard
Step 2: Creating a Data Set.

Select “add new item” to add a dataset to the project


Add the new data set to the app_code folder

Step 3: Drag Table Adapter & Use the configuration wizard to configure the data set.

Select connection string


Select one from options given
Solution explorer updated with dataset

Instead of dataset you can also use object DataSource as data source of rdlc file.

Step 4: 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 to
the report fields
Drag and drop a table from tool box.
Click on Reports→Data sources to add data sources to the report

Drag and drop the fields you wanted on the detail section of the table.
Add footer if needed

Place whatever controls you want on the report and drag field to its expression
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

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
Step 6: 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.

Step7: Run the web page and you will be able to view the report.
Step 8: How to attach DataSource dynamically from C# to rdlc file
Step 9: 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 });

Step 10: How to set the report style landscape?

Change this to 29.7cm & 21cm for A4 Landscape.

Step 11: Deployment Note.


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

<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd"

verb="*" type="Microsoft.Reporting.WebForms.HttpHandler,Culture=neutral" resourceType="Unspecified"/>

</handlers>

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 manually, 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 (http://msdn.microsoft.com/en-us/library/ms251723.aspx)

(http://msdn.microsoft.com/en-us/library/ms251723.aspx)

If you are publishing the webstie using framework 3.5 use “Allow this precompiled site to be updatable.

Date Validation in RDLC Reports

01. IIf(FormatDateTime(Fields!ReturnDate.Value,2)=CDate("1/1/0001"),
02. DateDiff("d", Fields!DueDate.Value, Today()) * Fields!LateFee.Value,
03. DateDiff("d", Fields!ReturnDate.Value, Fields!DueDate.Value))

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://www.ssw.com.au/ssw/standards/rules/rulestobetterSQlreportingservices.aspx)

http://aspalliance.com/articleViewer.aspx?aId=914&pId=-1 (http://aspalliance.com/articleViewer.aspx?aId=914&pId=-1)

http://msdn.microsoft.com/en-us/library/xt50s8kz.aspx (http://msdn.microsoft.com/en-us/library/xt50s8kz.aspx)

http://technet.microsoft.com/en-us/library/ms157328.asp (http://technet.microsoft.com/en-us/library/ms157328.aspx)

Hope this helps


Tags: ASP.NET, RDLC

Ads by Google

► ASP Net C#
► Visual Studio C#
► Crystal Reports
Ads by Google

► SSRS Report
► VB Net Visual Studio 2010
► Microsoft Access

2 comments (http://livefyre.com)

Sign in or Post as Guest 13 people listening

+ Follow Share Post comment as...

Newest | Oldest | Top Comments

ancievarghese (http://www.livefyre.com/profile/53356655/) Jul 11, 2014


(http://www.livefyre.com/profile/53356655/)
i would like to know how to display external images from a sharepoint picture library url and pass it via report parameter to
view in rdlc report...Urgent please help

Like Reply

Biju Joseph (http://www.livefyre.com/profile/19005315/) moderator Jul 12, 2014


(http://www.livefyre.com/profile/19005315/)
@ancievarghese (http://www.livefyre.com/profile/53356655/)

ReportParameter Param0 = new ReportParameter("ImageUrl", string.Format("{0}", <<ImageUrl>>));


ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { Param0 });

Like Reply

Ads by Google

► VB Net Report
► How to Create a Website
► Find Report Designer

Translate this page Spanish

Microsoft® Translator (http://www.bing.com/translator?ref=MSTWidget)


(http://www.microsoft
(mailto:?

Related Blogs

Understanding ASP.NET Basics (http://tech.just4sharing.com/Pages/ASP/Understanding-ASP.NET-Basics.aspx)

ASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web
applications and Web... view post... (http://tech.just4sharing.com/Pages/ASP/Understanding-ASP.NET-Basics.aspx)

How to do a simple RDLC report using Visual Studio (http://tech.just4sharing.com/Pages/ASP/How-to-do-a-simple-RDLC-


report-using-Visual-Studio.aspx)
RDLC stands for Report Definition Language Client-side. RDLC can be run completely client-side in the ReportViewer control. This removes the
need for... view post... (http://tech.just4sharing.com/Pages/ASP/How-to-do-a-simple-RDLC-report-using-Visual-Studio.aspx)

ASP interview questions (http://tech.just4sharing.com/Pages/ASP/ASP-interview-questions.aspx)

Explain the Validation Controls used in ASP.NET 2.0 - Validation controls allows you to validate a control against a set of rules. There are 6...
view post... (http://tech.just4sharing.com/Pages/ASP/ASP-interview-questions.aspx)

How to use SQLite database in Visual Studio (http://tech.just4sharing.com/Pages/ASP/How-to-use-SQLite-database-in-


Visual-Studio.aspx)

Recently I had a chance to work with SQLite to be used as dynamic storage media for Logging messages from Microsoft Message Queue.
view post... (http://tech.just4sharing.com/Pages/ASP/How-to-use-SQLite-database-in-Visual-Studio.aspx)

SharePoint Developer Tools (http://tech.just4sharing.com/Pages/sharepoint/SharePoint-Developer-Tools.aspx)

SharePoint Manger 2010 and SPDisposeCheck are some of the great tools for developers and administrators. view post...
(http://tech.just4sharing.com/Pages/sharepoint/SharePoint-Developer-Tools.aspx)

how to get IP address of the user (http://tech.just4sharing.com/Pages/ASP/how-to-get-IP-address-of-the-user.aspx)

I wanted to get the IP4 version of the user''s IP and found this piece of code in net. Hope this will help you as well, view post...
(http://tech.just4sharing.com/Pages/ASP/how-to-get-IP-address-of-the-user.aspx)

Working with Dependency Injection in Net (http://tech.just4sharing.com/Pages/ASP/Working-with-Dependency-Injection-in-


Net.aspx)

Dependency Injection is also known as Inversion of Control (IOC). It is a design pattern that remove tight coupling between dependent
components.... view post... (http://tech.just4sharing.com/Pages/ASP/Working-with-Dependency-Injection-in-Net.aspx)

.Net Overview (http://tech.just4sharing.com/Pages/ASP/Net-Overview.aspx)

My objective is just to provide a real snap over the .Net Framework and it''s architecture. As a windows programmer it is really important&n...
view post... (http://tech.just4sharing.com/Pages/ASP/Net-Overview.aspx)

SP Master Page Content Placeholder Description (http://tech.just4sharing.com/Pages/sharepoint/SP-Master-Page-Content-


Placeholder-Description.aspx)

SharePoint has various Page Content Placeholders in its Master Pages. Some of them are described here... view post...
(http://tech.just4sharing.com/Pages/sharepoint/SP-Master-Page-Content-Placeholder-Description.aspx)

C-Sharp code to determine a visitor's IP address (http://tech.just4sharing.com/Pages/ASP/C-Sharp-code-to-determine-a-


visitor)

Asp.net with C# provides ways of determining IP addresses of visitors to your website. Simply check the server variables
HTTP_X_FORWARDED_FOR,... view post... (http://tech.just4sharing.com/Pages/ASP/C-Sharp-code-to-determine-a-visitor)
Live Traffic Feed
A visitor from India arrived from google.co.in and
viewed "How to do a simple RDLC report using
Visual Studio" 3 mins ago
A visitor from Iran, Islamic Republic of arrived
from google.com and viewed "How to do a simple
RDLC report using Visual Studio" 23 mins ago
A visitor from Taipei, Tai-pei arrived from
google.com.tw and viewed "ASP.NET User
Control - Event Handling and Event Delegation
with example"
A visitor 25 mins ago
from Bogotá, Distrito Especial arrived
from google.com.co and viewed "How to do a
simple RDLC report using Visual Studio" 25 mins
A visitor from New Delhi, Delhi viewed "How to
ago
do a simple RDLC report using Visual Studio" 27
mins ago
A visitor from Chennai, Tamil Nadu arrived from
google.co.in and viewed "How to do a simple
RDLC report using Visual Studio" 30 mins ago
Real-time view · Get Feedjit

About

Welcome to my blogs. My SharePoint and .NET Experience is shared for everyone. Mail me (mailto:[email protected]?
Subject=My%20Article) your suggestions and they are always welcome.

EMail Subscriptions

Would love to receive new blog alerts in your inbox?

Email Address Subscribe

Featured Blogs

How to do a simple RDLC report using Visual Studio (http://tech.just4sharing.com/Pages/ASP/How-to-do-a-simple-


RDLC-report-using-Visual-Studio.aspx)

Content Type Hub in SharePoint 2013 (http://tech.just4sharing.com/Pages/tech/Content-Type-Hub-in-SharePoint-


2013.aspx)

Configuring Windows Azure Access Control Service and Facebook authentication in SharePoint 2013 – Part 1
(http://tech.just4sharing.com/Pages/tech/Configuring-Windows-Azure-Access-Control-Service-and-Facebook-
authentication-in-SharePoint-2013-Part-1.aspx)

Contact Us
Biju Joseph(MCSD)
SharePoint Consultant
Bangalore, INDIA
Phone: +919741600911
Email: [email protected] (mailto:[email protected])

Stay Connected

2012 © just4sharing. ALL Rights Reserved. Privacy Policy | Terms of Service

(http://just4sharing.com)

You might also like