How to not render blank reports?

Hi,

Currently I am programmatically printing SQL Server Reporting Services reports using a C# console application (most of the code I got from Bryan Keller’s weblog http://www.csharphelp.com/archives3/archive545.html).

The problem I am having is that when a report is blank (i.e. its data sets don’t return any data) I don’t want it to be printed. If I don’t want a blank Access report to print I set the following event in VBA:

Sub Report_NoData(Cancel As Integer)

Cancel = True

End Sub

Then any code that tries to print this report will receive an error when it is blank. I can then capture the error and the report won’t print.

I am wanting to do a similar thing when printing SQL Server reports. My ideas so far have been to:

1) Somehow programmatically execute the DataSets used by the SQL Report. So far I have not found anything within the ReportingService web service to do this.

2) Set an Expression on the NoRows property of the SQL Server report, that will compile, but when a report is Rendered that has no data, an exception will be thrown. This exception could then be caught and the report wouldn’t be printed. I haven’t been able to come up with a statement to achieve this either.

Has anyone else had any luck with this sort of thing Any help is appreciated.

Thanks, Matt


Answer this question

How to not render blank reports?

  • How to not render blank reports?