Month: December 2011

Reporting Services RDL Report

The following video shows how you can create a simple RDL report, deploy it to the Report Server, and view it from the Report Manager in SQL Server 2008 Reporting Services:

Video 1 – Create a simple server-side report in Reporting Services.

Video 2 – Export a server-side RDL report from a .NET Windows Application.

Report.cs (6.76 kb) to download Report Class that’s used in video 2.

Click NunoSolutions.7z (69.20 kb) to download the sample project used in the video 2.

One more thing, make sure to update the user credentials with an user that has access to run reports.

Export SRS 2008 Report from Windows Applications

The following code was written and tested against SQL Server 2008 R2 Reporting Services. The helper classes help reduce and simplify the amount of code you’ll have to write (and remember) when exporting reports from SRS. I included the ReportExecutionService proxy class that I generated using the WSDL.exe tool. However, you can add a web reference to it using the GUI tools in VS.NET. For those of you who are interested in the command I used:

Open the Visual Studio 2010 Command Prompt (it should be located in Start>All Programs>Visual Studio 2010>Visual Studio Tools>Visual Studio Command Prompt) and enter the following:

 

·         C:\wsdl http://localhost/reportserver/reportexecution2005.asmx

 

 

Here’s what the code will look like to export a report:

NunoSolutions.Report rpt = new NunoSolutions.Report();

rpt.ReportServerUrl = http://localhost/ReportServer; // Change localhost in this path to your server’s name

rpt.ReportTitle = “My Northwind Customers”; // This value is used as the file name

rpt.ReportFormat = NunoSolutions.REPORT_FORMAT.PDF;

rpt.ReportPath = “/Northwind Reports/Northwind Customers”; // The “/Northwind Reports” part is the folder name in Report Server/Manager

// The credential set below must have access to the report server

NunoSolutions.ReportHelper.UserName = “<YourUserName>”;

NunoSolutions.ReportHelper.Password = “<YourPassword>”;

NunoSolutions.ReportHelper.Domain = string.Empty; // In corporate environments you’ll need to set this

// You can change this method declaration to support a file path input parameter.

// For demo purposes, I have a Folder Browser Dialog popup to prompt you where

// you’d like to save the report file.

NunoSolutions.ReportHelper.Export(rpt);

 

Download the sample source code here:

NunoSolutionsWindows.7z (61.39 kb)