Problems with C# and Crystal Report integration

Posted on 2003-02-27
Medium Priority
Last Modified: 2012-08-13
I'm using Visual Studio C# .NET, and have created a program that does basic data retrieval from an SQL Database.  One of the requirements of the program is to create reports based off the data, so I'm trying to figure out Crystal Reports to do it.  However, I've tried setting it up, and I keep running into this problem:

Load Report Failed - "CrystalDecisions.CrystalReports.Engine.LoadSaveReportException"

I created the report within the .NET project, and set up a ReportDocument within the form with the CrystalReportViewer, and set the report source to the ReportDocument.  The report itself is set to 'embedded resource'

From everything I can figure out, my program crashes as soon as the ReportDocument object is added to my project.  Specifically, it crashes when it hits the print properties for the ReportDocument.  I tried simply removing those properties, and it did stop crashing, but the program still refused to load the report.

I have also tried doing it programmatically, using this basic setup in the Load for the form  -  DriversByLocation.ReportSource = new cr_drivers_by_location();"  -  where DriversByLocation is the CrystalReportViewer and cr_drivers_by_location is the the embedded report.  This didn't cause the program to crash, but the report will still not load.

I am at a complete loss in trying to figure this out, and all the documentation I've been able to find doesn't cover this error, besides telling me that the program can't open the report.  I would prefer to keep the reports embedded in the program, so that I don't have to deal with external report files.  Any help?
Question by:cranedj
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 8037715
i haven't had much success using crystal... especially when it's using their objects for dynamic report creation. the only way i was able to get it configured properly was to contact thier developer support. they should be able to get you set up (although free developer support is a lower priority than subscription based support).

Author Comment

ID: 8039288
A small update here - I read in some documentation that instantiating an instance of the report in the form that has the report viewer is another method of binding the data to the viewer control.  I set it up this way:

//Instantiate the report
cr_drivers report = new cr_drivers();

//Bind the control to the report
cv_drivers.ReportSource = report;

I've gotten beyond causing the program to crash.  However, the program still absolutely refuses to view the report, and keeps giving me the "Report Load Failed" error message with no details for fixing the error.  All I get is a popup that says it couldn't load, and an OK button.

Author Comment

ID: 8042849
I apparently solved the problem myself, although it doesn't make any sense.  I just created a new project, and made a form that accessed a report through the crystal report viewer.  Then I copied and pasted all my code files and forms over to my new project, and changed the namespace.  I changed none of my code, and now it magically works.  Gotta love consistency.....
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8043844
gotta love crystal reports... if it WORKED

Author Comment

ID: 8245773
Since I came up with a solution myself, I guess this question should be closed.  Not sure if this is where I do it or what.

Accepted Solution

Computer101 earned 0 total points
ID: 8317027
Points refunded and question placed in PAQ

E-E Admin

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question