Pro SQL Server 2012 Reporting Services

(sharon) #1

C H A P T E R 9


Rendering Reports


from .NET Applications


Report rendering is the process of outputting the results of a report into a specific format. You pass the
appropriate parameters to SSRS, telling it what report you want to run and optionally what format you
want the output in, any user credentials, and the actual report parameters. SSRS 2012 then renders the
report and returns the results.
The manner in which you pass these parameters and how the results are returned depends on the
SSRS 2012 method you’re using to render the report. Once SSRS has the information it needs, based on
the particular report you’re running, it queries the appropriate data sources. SSRS 2012 uses the passed
credentials and parameters if appropriate, renders the report into an intermediate format, and then
renders and filters this intermediate format into the final display format requested.
With SSRS 2012, you can render reports in three ways from a .NET application:


Using a URL: You can build a URL that allows the client to access the report on
the report server and supply any appropriate parameters, including rendering
format, login information, report criteria, and report filters. This method is one
of the most flexible because it will work with almost any language and platform
that can host or use a Web browser or a Web browser control. In fact, it works
with any language that can create a properly formatted URL and that can
launch a Web browser using that URL. We can use the built-in WebBrowser
control in .NET with formatted URLs to render a report.

Using the SOAP API: You can use the SOAP API, also known as the Report Server
Web service, to render the report. This returns the rendered data as a stream
that you then display. This is a more difficult method of rendering because the
information you get back from the server is essentially a binary stream of data,
and you don’t have the benefit of having the server-browser combination do
the actual work of displaying the data. However, you can use the Report Server
Web service for more than just rendering: you can use it to access the report
server’s complete functionality. We’ll show how you can use the Report Server
Web service in your solution to provide information about the reports you’re
rendering, such as the report parameters that the reports use.

Using the Report Viewer control3.0: You can use the Report Viewer control. This
option for SSRS 2012 provides a simple-to-use Windows Forms application or
ASP.NET user control that allows you to simply drag and drop the control onto
a Windows or Web Form, set some properties, and render a report. One of the
main benefits of the Report Viewer control is that it allows you to render reports
that are on an SSRS 2012 report server as well as render reports locally, without
the need for a report server.
Free download pdf