Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1241
  • Last Modified:

Problems with C# and Crystal Report integration

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?
0
cranedj
Asked:
cranedj
  • 3
  • 2
1 Solution
 
msdixonCommented:
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).
0
 
cranedjAuthor Commented:
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.
0
 
cranedjAuthor Commented:
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.....
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
msdixonCommented:
gotta love crystal reports... if it WORKED
0
 
cranedjAuthor Commented:
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.
0
 
Computer101Commented:
Points refunded and question placed in PAQ

Computer101
E-E Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now