SQL Server Reporting Services makes it easy to build reports from database data, but what if the data isn't in a database? This article shows you how to take advantage of Reporting Services' unique extensibility model to build reports from ADO.NET datasets.

by Teo Lachev

Apr 25, 2006

Page 6 of 6

Report Delivery
The article code includes VS.NET 2005 Windows Forms and ASP.NET test projects that demonstrate how custom applications can use the CDE. The test projects leverage the Windows Forms ReportViewer and ASP.NET ReportViewer control respectively. If you cannot use the ReportViewer controls in your applications, you can call the Render method of the SSRS ReportExecution Web service, which is what the controls do behind the scenes.

Thanks to the fact that the report viewers abstract most of the SSRS Web service technicalities, generating the TestDS report is remarkably simple, as shown below.

First, the code configures the ReportViewer for remote mode since we will be requesting a deployed (managed) report. Next, the code calls SetParameters to pass the dataset as a report parameter. For testing purposes, the code loads the ADO.NET dataset from a file. In real life, the dataset can come from anywhere (e.g. from a business logic layer) as long as it conforms to the dataset schema used by the report. Next, the code passes the XML representation of the dataset as a ReportViewer parameter. Finally, the code calls the RefreshReport method of ReportViewer to submit the report request and render the report.

I'm a firm believer that no matter how feature-complete and mature a given tool is, if it's not extensible or if it's built on proprietary technologies it will probably fail to meet demanding requirements. If you were to ask me what SSRS's most important feature is, I'd answer, "open and extensible architecture."

In this article, you've seen how to extend the default SSRS data architecture by writing a custom data extension. You can use the sample CDE which accompanies the article code to build reports that use data from ADO.NET datasets. Consider this extension when your application needs to bind an ADO.NET to a server reporta scenario which is not currently supported by versions 2000 and 2005 of Reporting Services.