May 10, 2006 at 7:20 pm
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
May 14, 2006 at 2:57 pm
May 21, 2006 at 10:03 pm
Sounds like a good idea if I can work out how to export to XML programmatically. I will give it a go in the next few days and let you know.
Matt
May 21, 2006 at 10:20 pm
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply