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 reporta scenario which is not currently supported by versions 2000 and 2005 of Reporting Services.