I just want to say up front that I hate Crystal Reports. Not because it's difficult to design very nice reports with it but because the version that comes with Visual Studio 2008 is crap when it comes to deployment... If you've tried to use it there are a number of issues that you will run into. And most likely they'll be in this order:
-
Works fine in development, deploy it and it stops working.
-
You get it working, but you can't load the report (if you're using pre made rpt file)
-
You are constantly greeted with a login screen each time you go to the page.
-
None of the graphs show up.
-
None of the images in the bar show up.
I wont get into formatting issues, the fact that it doesn't use tables/divs as you'd expect, no way to automatically format columns easily, etc. The reason I'm not going into that, is if it doesn't deploy, you don't need to worry about the other issues. However I've got the fixes for all of the above issues and I'm here to let you know so that it doesn't annoy you as well.
Works Fine in Development, Stops When Deployed
There's actually quite a few reasons that this could happen (not the correct rights, issues with the database, etc.), however the one that I ran into that everyone else seems to have is the simple fact that you have to deploy the run time components onto the server prior to getting it to work. This can be done in a couple of ways (Web deployment project, etc.), however the easiest thing to do (assuming you have access to the server), is to simply go here:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5\
and grab the appropriate msi package to install on the server. Doing this will most likely fix the first issue that you'll run into.
I Can't Load A Report
Most likely you have a web application. It's as though the Crystal Report people didn't test any deployment what so ever with web applications. If they did, they'd have noticed that the reports are generated as embedded resources. And if you're calling the Load function on the ReportDocument (as many examples show), it's not going to find that rpt file. Even if you try to load it using the path to the WebResource.axd to load the embedded resource, it wont work. The reason for this is that it can't load URIs... So make sure to switch those items from embedded resources to content and make sure they copy over if newer or always...
How Can I Get Rid Of This Login Screen
For whatever reason the report itself doesn't keep track of the login information properly. To fix this one, all you need to do is set it using DocumentReport.SetDatabaseLogon(...) after the Load function is called (or prior, either works). But this will annoy the hell out of you for a while until you find that function.
None Of The Graphs Are Showing Up
I hate controls that automatically go into the web.config file and add items without any way of you knowing what they are (although Crystal Reports is fairly simple to figure out). What I hate more though, is when they go in and add only a portion of the items that you'll end up needing. In the case of Crystal Reports, if you want graphs, you have to add a handler. Specifically you need the CrystalImageHandler.aspx...
1: <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
The Crystal Image Handler is one of those things that should be added or at least they should let you know that you'll need it...
The Bar At The Top Is Missing Images
When you deploy the web application, a couple directories are going to be generated for you. Specifically the aspnet_client directory. This directory is going to house all of the items that Crystal Reports needs to run properly. However, the directory will sometimes have a big issue... One of the sub folders is named incorrectly... Specifically CrystalReportWebFormViewer3 should be CrystalReportWebFormViewer4... I mean did they even test the application when Visual Studio 2008 came out?
Suffice to say, there are a LOT of potential annoying features of Crystal Reports that you might run into and hopefully I've covered the one that you're experiencing. If not, well, I wish you the best of luck... And don't worry, support groups for those abused by Crystal Reports will most likely start springing up in your area soon (they beat you because they love you?). Anyway, I really do hope this helps someone out there as it shouldn't be this annoying. So good luck and happy coding.