- Using the Crystal Reports SDK for VS .NET
- When using PrintToPrinter function all reports print, even those with no data
- To stop wasting a blank page, how to stop the print if no data is retrieved for the report?
- There are at least four options:
- Check a field that will be some particular value if and only if the report has no data (e.g.; some field is NULL). If the field is NULL don't enter the print function
- Retrieve the SQL query that returned the data and check if number of records returned is zero. See KBase 1280515 - How to extract SQL query from Crystal reports using RAS sdk
- Use the rowset controller to check number of records used in the report. See KBase 1471477 - Using the RAS SDK for VS .NET, how to determine number of data rows returned to a report?
- Use the following code for CR for .NET SDK:
If crReportDocument.Rows.Count > 0 Then
crReportDocument.PrintToPrinter(1, False, 0, 0)
Forum thread , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To
Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2