Search KB Filter article types
How to use the Report Viewer Control to access a Reporting Services Server
Large organizations that make use of SQL server may well also use Reporting Services to create a corporate reporting solution that is accessible across the corporate LAN / WAN.
This article shows how to access such a server using the report viewer control.
Categories: Reports, ASP.NET, Wrapped Controls
Tags: Architects, Developers, Wrapper, C#, 2. Intermediate, 3. Advanced, Wrapping Controls, v6.3, v6.4 and Later
Revision: 2
Posted: 20/Sep/2010
Updated: 26/Sep/2010
Status: Publish
Types: Code

The tree view control will list all the available folders and reports within them.

Reports can then be run by clicking on the control, producing results like those below.

Note you will not be able to run the sample unless you have access to a reporting services server.

If you do you will have to
• Change the Web Reference in the project to suit
• Change the connection string in the web config file

I have left some blocks of code in the app which are either commented out or not used that demonstrate how to pass parameters to server side reports, and also how to pass user credentials to the report server, which will be required if users have differing access right to view and run reports.

RDL files are created by the SQL Server 2005 version of Report Designer. RDLC files are created by the Visual Studio 2005 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.

Note that 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 DataTables.

For the security aspect see the link below
http://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(v=VS.80).aspx

About the author

Related Articles

Reports  
Title Update Author
Hello Everyone, I've successfully wrapped the Crystal Reports Viewer for VisualWebGUI. In addition to the wrapper, I demonstrate the use of 2 other approaches using a Server Control and an AspPageBox/AspPageBase. I hope this helps you! Thank you - Ryan D. Hatch ryan [.] hatch [at] konect [com]
Tags: Developers, Wrapper, 1. Beginner, 2. Intermediate, Wrapping Controls, Pre v6.3, v6.3, 3. Advanced
08/Jan/2009    2009/01/08
Hi Guys - Here is the Crystal Reports Viewer for .NET 3.5. Some people requested this. Enjoy! Ryan
Tags: Developers, Wrapper, 1. Beginner, 2. Intermediate, Wrapping Controls, Pre v6.3, v6.3, 3. Advanced
08/Jan/2009    2009/01/08
Tags: Developers, Gateway, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
09/Jan/2008    2008/01/09
Tags: Architects, Developers, Wrapper, 2. Intermediate, 3. Advanced, Wrapping Controls, ASP.NET, v6.3, v6.4 and Later
07/Jan/2007    2007/01/07
This video demonstrates how to use reporting services in Visual WebGui.
Tags: Developers, Wrapper, 1. Beginner, Data Binding, ASP.NET, Pre v6.3, v6.3, v6.4 and Later, 2. Intermediate, 3. Advanced
01/Jan/2009    2009/01/01
This video demonstrates how to use reporting services in Visual WebGui.
Tags: Developers, Wrapper, 1. Beginner, Data Binding, ASP.NET, Pre v6.3, v6.3, v6.4 and Later, 2. Intermediate, 3. Advanced
11/Jan/2007    2007/01/11