Crystal Reports, issues, and fixes

9/26/2008

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:

  1. Works fine in development, deploy it and it stops working.
  2. You get it working, but you can't load the report (if you're using pre made rpt file)
  3. You are constantly greeted with a login screen each time you go to the page.
  4. None of the graphs show up.
  5. 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.



Comments

John
August 20, 2011 8:56 AM
I've have a love/hate relationship with Crystal Reports. I have a wrapper class around it where I can hand it off parameters and the file and it handles everything else. Once you get the permissions setup on the server (had to install the base packages for it) for NETWORK SERVICE I haven't had a lot of issues on deployment (I'm not using the Viewers, we have a custom report viewer that reads our report objects and dynamically lays out search forms that create PDF outputs). The biggest issue I've faced (and finally) fixed it handing off of credentials to login in different environments. Crystal is very particular in how it can be done via code (it has to be done a certain way and in a certain order). The documentation is pretty poor regarding it. Unfortunately, there aren't a lot of good alternatives. We looked at Birt but it has quiet a few limitations also (and is a Java Product without reasonable .Net hooks). I suppose Report Services is Ok but it seems like throwing a gi

James Craig
September 20, 2010 7:33 PM

To be honest, no idea. I haven't worked on Crystal Reports in about a year and a half. That being said, if the error is coming from a local IIS site (which it looks like if you're using inetpub), make sure your security is set up properly (that the site has access to the CrystalReportWebFormViewer4\images\toolbar location). If you're hitting f5, you need to copy those directories into your project. But past that, I'm not 100% sure.

Mary
September 20, 2010 4:17 PM

Howdy. I had a VS03/.NET1.1 web app that I converted to VS08/.NET3.5. Most of the Crystal Reports reports work, but a few don't. I had not converted all my .RPT files, so I figured I'd try that first. When I open a CR report in VS08, I get the following error:Error 1606: Could not access network location s:CrystalReportWebFormViewer4\images\toolbar.I have tried establishing a virtual directory on my local (dev) machine, and I have tried copying the aspnet_client directory to just inside my app folder in inetput\wwwroot. No go. This is not happening on my production server, as I normally produce .PDF or .XLS (.CVS) output. I think this is just for viewing inside VS08 or using a native VS08 viewer?Can you give me ideas how to rid myself of this error?

James Craig
September 08, 2010 8:19 AM

Sadly from my experience and the horror stories I've heard from others, Crystal Reports is probably one of the buggiest pieces of code I've seen. That being said, to be honest, I haven't run into your issue and I'm not sure how to fix it. Of course the reason I probably didn't run into it might be because I convinced them to instead switch to SQL Server Reporting Services and Excel Services in SharePoint for their reporting (except in odd situations where it needs to be formatted a specific way, but I created my own app for those instances). That being said, I pretty much agree with your assessment of the product.

Shaun
September 08, 2010 1:55 AM

I found your article to be grimly amusing given the drama I have experienced/am still experiencing with deploying Crystal to a Production webserver. I built the reports using VS 2008 and of course have run into the problem you describe in the first issue i.e. falls over the first time in Production because it can't find the proper assemblies. I tracked down the fix for the error, as you have, to running the msi installer on the web server. Problem is, my sysprog won't run it, so do you know of any other way to load the appropriate assemblies into the GAC, and what other files to I need and where on the server.If I can get past this pile of shit, I will no doubt be faced with another, and then another ever increasing pile of shit.BTW..I found your site by googling "Crystal Reports is a load of shit".