Monday, February 20, 2012

rendering reports without a server

Hi,
I read a book (Pro SQL Server Reporting Services) that mentioned that SRS
2005 will give users the capability to render reports without a server.
Well, I now have SRS 2005 but I still cannot see how this is done. How does
one render reports without a server? Is it because of the Report Viewer
control? If so, in what way is it possible to render reports w/o the server?
Here is the text from the book (my apologies to the publisher)
"For many software projects, one of the main limitations of SRS 2000 was
that it required you to have a server running SRS. This made it difficult or
impossible in some environments, and in certain scenarios, to utilize SRS as
the reporting mechanismâ'for example, if you had a user with a laptop who
needed to run reports while disconnected from the network where your SRS
server was located. As a result, users often fell back on technologies such
as Business Objects Crystal Reports or Data Dynamics Active Reports. With SRS
2005, this problem has been solved. The same new rendering controls that make
it easier to render your reports with SRS 2005 make it possible to render
them without a server at all.
These new controls can render reports without the need to have access to an
SRS server. With SRS 2005, you now have a single technology reporting system
that can provide a viable solution across a wide variety of applications and
circumstances. No longer will you have to use one technology for applications
without access to a server and an entirely different and incompatible
technology for those applications with access to a server.
This implementation is well thought out and well implemented in SRS 2005.
The controls use the same RDL as the SRS server and offer the option to
render reports locally without the need for an SRS server. Local report
rendering supports background processing and offline snapshots, thus
providing a very powerful solution for a variety of needs. With local
rendering you can distribute report generation to local systems, provide
reporting capabilities to users while disconnected from the network, and
more. You can also use the same control to view reports rendered by an SRS
server. This gives you a great option to use the same user interface
regardless of whether or not you have an SRS server.
The beauty of this is that the exact same report can be deployed two
different ways depending on your need. You can deploy directly to a desktop
system where connectivity to an SRS server is not desirable or possible, and
to an SRS server when scalability and enterprise features such as report
history, running reports on a schedule, and push delivery are important. This
also offers some great options if you need to generate reports on
applications running on a laptop.PacMan wrote:
> Well, I now have SRS 2005 but I still cannot see how this is done.
> How does one render reports without a server? Is it because of the
> Report Viewer control? If so, in what way is it possible to render
> reports w/o the server?
Add a reference to Microsoft.ReportViewer.WinForms.
Now you'll find in the Microsoft.Reporting.WinForms namespace is a class
called LocalReport. This is what you need to use to do the work.
Generating the report is absolute simplicity. Create your .rdl file using
the SQL Server 2005 Business Intelligence Development Studio (or
alternatively, create an .rdlc file by adding a Report to a standard VS2005
project -- but you'll get no preview window this way, so the BIDS approach
is superior IMO). Then create a LocalReport object and provide it with the
.rdl file (using the LoadReportDefinition method).
Now you need to provide data for each of the DataSources in the .rdl file.
Do this by adding ReportDataSource objects to the LocalReport's DataSources
collection. Each ReportDataSource should be initialised with two parameters:
the name of the DataSource (as defined within your .rdl definition) and a
DataTable object (that contains the data to be included within the report).
Finally, call the Render method as follows:
document = report.Render("PDF", Nothing, Nothing, Nothing, Nothing,
Nothing, Nothing)
This will return a byte-array inside which will be the rendered report.
That's it.
Note however that charts in PDF documents are rendered UNCOMPRESSED. This
results in absolutely huge PDF files (a report I made that contained a
couple of charts that rendered at 70KB on the server was generated at a
little over 7MB by the ReportViewer).
HTH,
--
(O)enone|||One additional thing to note. If you installed sut the Business Intelligence
Development Studio I don't think that the controls come with it. The
controls come with Visual Studio.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Oenone" <oenone@.nowhere.com> wrote in message
news:uogWt%23sNGHA.208@.tk2msftngp13.phx.gbl...
> PacMan wrote:
>> Well, I now have SRS 2005 but I still cannot see how this is done.
>> How does one render reports without a server? Is it because of the
>> Report Viewer control? If so, in what way is it possible to render
>> reports w/o the server?
> Add a reference to Microsoft.ReportViewer.WinForms.
> Now you'll find in the Microsoft.Reporting.WinForms namespace is a class
> called LocalReport. This is what you need to use to do the work.
> Generating the report is absolute simplicity. Create your .rdl file using
> the SQL Server 2005 Business Intelligence Development Studio (or
> alternatively, create an .rdlc file by adding a Report to a standard
> VS2005 project -- but you'll get no preview window this way, so the BIDS
> approach is superior IMO). Then create a LocalReport object and provide it
> with the .rdl file (using the LoadReportDefinition method).
> Now you need to provide data for each of the DataSources in the .rdl file.
> Do this by adding ReportDataSource objects to the LocalReport's
> DataSources collection. Each ReportDataSource should be initialised with
> two parameters: the name of the DataSource (as defined within your .rdl
> definition) and a DataTable object (that contains the data to be included
> within the report).
> Finally, call the Render method as follows:
> document = report.Render("PDF", Nothing, Nothing, Nothing, Nothing,
> Nothing, Nothing)
> This will return a byte-array inside which will be the rendered report.
> That's it.
> Note however that charts in PDF documents are rendered UNCOMPRESSED. This
> results in absolutely huge PDF files (a report I made that contained a
> couple of charts that rendered at 70KB on the server was generated at a
> little over 7MB by the ReportViewer).
> HTH,
> --
> (O)enone
>

No comments:

Post a Comment