Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Create Reports from Any Data Source Using SQL Server Reporting Services Custom Data Extensions : Page 6

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.


advertisement
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.

private void RunRemote() { reportViewer.ProcessingMode = Microsoft.Reporting.WinForms. ProcessingMode.Remote; // Get the Report Server endpoint from // the config file reportViewer.ServerReport.ReportServerUrl = new Uri(txtReportServer.Text); reportViewer.ServerReport.ReportPath = "/Prologika/TestDS"; // Bind the dataset SetParameters(); reportViewer.RefreshReport(); } private void SetParameters() { ReportParameter[] parameters = new ReportParameter[1]; EntitySalesOrder entitySalesOrder = new EntitySalesOrder(); sqlDataAdapter.Fill(entitySalesOrder); parameters[0] = new ReportParameter("DataSource", entitySalesOrder.GetXml()); reportViewer.ServerReport.SetParameters(parameters); }

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.



Teo Lachev works as a technical architect for a leading financial institution where he designs and implements .NET-centric Business Intelligence solutions. He is a Microsoft Most Valuable Professional (MVP) for SQL Server. Teo is the author of the books Applied Microsoft Analysis Services 2005 and Microsoft Reporting Services in Action.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap