Use SSRS Subreport in WinForm
What this Tool can do?
- View SSRS 2005 rdl and rdlc reports. If the report has subreport, both main report and subreport must have the extension ".rdlc" because rdl subreport cannot be found. Subreports msut be located at the folder as main report.
- Show DB Connection used in the main report. We assume that subreports use the same DB connection as the main report. If not, you need change the source code accordingly.
- Show the SQL query used in the main report.
Here is how a report with subreport can be shown by this tool
How to use this tool?
The tool is using ReportViewer coming with Visual Studio 2005, so the rdl or rdlc file must be in SSRS 2005 format. To view SSRS 2008 rdl or rdlc, you need upgrade the source code and recompile it with VS 2010.
It is very straightforward to use this tool. First launch the tool, and then click the file explorer button to choose the SSRS file to view. Here is the screenshot.
After that, click on the "View Report" button. That is it.
Download and Try this Tool
The source code and binary are availble. From this tool, you will know how to view SSRS report file from winform.
- Dynamically set report data source and dataset to report. Since you can use this tool to view any report, we do not know what the data source and dataset will be.
- Retrieve the DB conncection string from the SSRS file itself. If the DB connection is not correct, you need fix it in the rdl or rdlc file first.
- Get the sql command used in the SSRS file. Currently it does not work for stored procedures or parameters in the sql command. But if you need, you can easily change the source code to achieve this.
- How to show subreport by using event handler SubreportProcessing.
You can download the tool, source code and testing rdl and rdlc files here.