Wednesday, March 2, 2011

Crystal Reports with Visual Studio

Recently I was trying to work with Crystal Reports for learning purpose and I have ran through couple of issues. Solutions to these issues were trivial but took good amount of time in research.

It goes without saying that you should have a valid installation of Visual Studio with crystal report basic and valid license on the server for running crystal reports.

Issue No. 1 - Can't see images for Crystal report viewer, or not able to use the export, print functionalities when deployed to another web server.

Solution : This happens because crystal repots viewer assumes a very specific directory structure for the images and scripts. If you are running IIS on your development machine, you can find the structure here "C:\inetpub\wwwroot\aspnet_client\System_Web\2_0_50727\CrystalReportWebFormViewer4"

Now all you have to do is that copy the content of this whole structure, right from aspnet_client to your webserver and create a virtual directory to point to this path. Even if you dont want to create a virtual directory or dont have access to do so, you can simply copy the full structure to the root of your webapp and that should do the magic.

If you are not using IIS and using a inbuilt webserver with Visual studio (cassini i.e.), still you will have this structure , only thing that in this case it would be available at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles

Inserting code in blogger was never so easy

I have always struggle for inserting code in my blog.
//Now it seems to be easy
Many thanks to him for sharing the knowledge

Tuesday, February 22, 2011

Crystal Report Error - Field name is not known

If you are getting the error while running the crystal report like this. "This field name is not known". The below step should fix your problem.

Ensure that database view is updated corrected and correct field name is being reffered from Crystal Report.

Then open the crystal report in Crystal Report view and From the Database Menu, select option " Verify Database " .
It would ask you credentials and then would ask whether you want to update. Click Okay and Save the report file.

Now try to run the report again. You should see the report without any problem. This was the solution I saw recently somewhere, and thought of posting it for everyone else. Hope this helps someone.