Skip to content

Tutorial

majorsilence edited this page Jan 24, 2013 · 10 revisions

(to be completed)

How to use the Designer

Please refer to the Create New Report page.

How to use the Viewer in your application

Please refer to the Winform Viewer page.

Calling the Viewer exe directly from your application

For the simplest way to present a report to the user, it is also possible to call the viewer exe via a system/Shell call, like any other command that can be issued from the command line (or batch file, Powershell, any other language etc) :

vb.net example

Dim ID As Integer  
ID = Shell("""C:\Fyi\RdlReader.exe"" C:\Fyi\myreport.rdl", , True, 100000)

This gives you the power of RDL based reports in just a line or two of code, with both the report designing stage and the viewing/printing of reports taking place outside of the programming environment or application. This is ideal as an introduction to RDL reporting, and as a bonus the knowledge gained in the process may one day be useful if you progress to the full blown MS Server based reports system.

This works well if the data shown to the user of your application is the result of a simple SQL query. By using a Stored Procedure both your application and your report can be sure to show the user exactly the same results. It would be more tricky if there are selection criteria involved, or the application is showing temporary data that can't be transfered easily to the report. The work-around to this problem would involve saving data to a temporary SQL table, with rows identified per user. The report SQL would need to select rows in that table for the required user. At this point you will probably look at closer integration into your application! (but I'd still be tempted to store a SQL query in the database for the user, and execute it dynamically in an SP!)

Clone this wiki locally