cancel
Showing results for 
Search instead for 
Did you mean: 

Data in DataSets, but error when trying to populate Crystal Report

Former Member
0 Kudos

I have been in the process of making changes to a legacy application as described in this post. [|]

I have changed the references from 10.0 to 10.2. The application included references to CrystalDecisions.CrystalReports.Design, CrystalDecisions.Enterprise.Framework and CrystalDecisions.Enterprise.InfoStore which did not have a comparable version in 10.2, so for the moment I have removed them.

I have then tried to run the application (compiles fine) and run into this error:

A first chance exception of type 'System.Exception' occurred in CrystalDecisions.CrystalReports.Engine.dll

The code where it fails is here, when it is trying to load it into the report:

private void SendDailyRentalDataToCrystal()

{

crystalFailure = false;

try

{

crystalDailyRentalReport.Database.Tables["ReportParameters"].SetDataSource(dsDailyRentalParameters);

crystalDailyRentalReport.Database.Tables["ReportData"].SetDataSource(dsDailyRentalData);

}

catch

{

crystalFailure = true;

string error = "Unable to generate the Daily Rental Report. ";

error += "There was a problem sending the data to Crystal Reports.";

System.Windows.Forms.MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

}

The DataSet visualizers for dsDailyRentalParameters and for dsDailyRentalData both indicate that there is valid data being returned from SQL Server. This code is part of a Win32 application developed using VS 2005 and the reports were originally developed using Crystal Reports 10.

Thanks for any help that you can provide.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

See if this post will help:

Ludek

Answers (4)

Answers (4)

Former Member
0 Kudos

Ludek-

It appears that during the course of trying to rectify the CR versioning issues that I had, I altered the functionality of the application. This morning I reverted back to the previous version of my application and started over on the changes. After all, I only had a couple small changes to make.

I now have a functioning application. However, I am not sure exactly what the cause of the last issue that I was fighting or how to fix it.

Anyway, thanks much for the assistance that you provided.

Regards,

Scott

former_member183750
Active Contributor
0 Kudos

Good news. I always say; "the hardest part is to figure out which "Any" key I pressed :)"

Good luck in your future projects,

Ludek

Former Member
0 Kudos

OK, I verified that "Verify on First Refresh" is check. No option exists for saving data.

former_member183750
Active Contributor
0 Kudos

That is correct. See if it runs now. I'll keep my fingers crossed...

Ludek

Former Member
0 Kudos

Ludek-

I did not find an option to check those settings within VS 2005. Does VS have a report designer or do I need to go back to CR 10 to check this?

Thanks,

Scott

former_member183750
Active Contributor
0 Kudos

Oops, forgot you're using CR 10.2, but no problem. If you are loading the report from path, best to do this in the CR designer if it is still available to you. If the reports are strongly typed (e.g.; crreportdoc = New Report1) Double click on the report in the solution explorer. On the design view of the report, right click on any empty space. From the pop up menu select "Report" and you will find "Report Options there".

Ludek

Former Member
0 Kudos

Ludek-

That thread was useful. I am now able to see that the dataset contains the data that I expect.

When I "Browse Field Data" each field returns values that I would expect. However, when I preview the report, I am getting data that is not even in the DataSet. It still generates, but not with results that I would expect. I am not sure how to interpret this.

Scott

former_member183750
Active Contributor
0 Kudos

A little strange, but try this:

Open the report in the CR designer, go to the File menu and ensure there is not check mark next to "Save data with report".

Next, again under the File menu, click on "report options". Find "Verify on first refresh". Enable this option. Save the report and refresh it (F5). Do you still see the weird data? If not, try the report in the app now.

Ludek