cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports XI R2 (.NET): ReportDocument.Rows.Count throws Exception

Former Member
0 Kudos

Hello,

There is the following code in my .NET project:


            ReportDocument MyReportDocument = new ReportDocument();
            MyReportDocument.Load(@"C:\MyReport.rpt");

            MyReportDocument.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
            MyReportDocument.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

            DiskFileDestinationOptions diskOpts = ExportOptions.CreateDiskFileDestinationOptions();
            diskOpts.DiskFileName = @"C:\ExportedReport.pdf";
            MyReportDocument.ExportOptions.ExportDestinationOptions = diskOpts;

            SetConnectionInfo(MyReportDocument);

            if (MyReportDocument.Rows.Count > 0)
            {
                MyReportDocument.Export();
            }

            MyReportDocument.Close();
            MyReportDocument.Dispose();

The following line throws the System.Data.EvaluateException: Cannot find column \[LOAD].:

if (MyReportDocument.Rows.Count > 0)

There is no "LOAD" column in my database tables and in my report.

Everything works fine when I comment this line.

I call this property to determine if any data is loaded.

I use Crystal Reports XI R2

So I have the questions:

-


1. What should I do to avoid this error?

2. Is there any alternate method or property?

I know that there is ReportDocument.HasRecords property in Crystal Reports 2008, but this property doesn't exist in Crystal Reports XI R2 version.

How can I determine if any data is loaded for XI R2 version?

-


Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

saurabh_pathak
Active Contributor
0 Kudos

Hi Andrey,

Lot of information required:

1) Service Pack you are on

2) Windows or Web Application

3) Visual Studio Version

Thanks,

Saurabh

Answers (0)