I've create a component for viewing SQL Reporting Service reports in WinForms applications. Unlike the MS suggested method of using the webbrowser component, mine uses a PrintDocument and calls the RS Web Service directly.
I can't take much credit for this as it's mostly just a wrapper for some code by Bryan Kellar. See his post here.
Anyways, you can download the code from here:
SQLRSPreview100.zip (76.11 KB). If you have any suggestions or find any bugs, drop me a line and I'll do my best to improve it - at least until MS provides something better.
Usage
There are 5 main properties on the component:
| RSServerURL |
URL for the report server ASMX file. |
| ReportPath |
Folder containing the report. You must include the trailing backslash. |
| ReportName |
Name of the report (excluding .RPT extension) |
| Document |
The PrintDocument. Use this in you PrintPreview control, PrintPreviewDialog control or PrinterDialog control. |
| Parameters |
When you set all 3 of the RSServerURL,ReportName and ReportPath properties, the component will try to connect to the web service and retrieve the report parameters. You can then use the Parameters array to set values before executing the report. |
Exception handling is non-existent. There are no nice property editors and very little validation. This is scheduled for a future release.