Labels

Wednesday, January 10, 2007

Crystal Reports for Visual Studio


Articles on using Crystal Reports in Visual Studio 2005

How to Deploy Crystal Report?

Unbound Currency Fields and Regional Settings

Some of the unbound fields in Crystal Reports are affected by the operating system's default settings. For example on a machine with a US locale the date will be of the format mm/dd/yyyy. For dates, this can be easily overridden by setting the DateWindowsDefaultType property to crNotUsingWindowsDefaults. Unfortunately such an option does not exist for currency fields. Setting the property CurrencySymbol is completely ignored and there is nothing you can do about it. The easiest workaround is to use a number field rather than a currency one and then use the CurrencySymbol property.

Deployment
First of all, ensure that your development machines have the latest service pack and critical updates. Once you have done that, download the latest merge modules.
Just to be safe, when you create a new setup project exclude Crystal_Managed2003.sms, which is automatically added by Visual Studio under Detected Dependencies. Then, manually add all the merge modules (yes all, even if you don't think you need them, you probably do; more information on this later on) that you downloaded as well as the following two merge modules that are not included in the download, but are already on your machine.
VC_User_CRT71_RTL_X86_---.msmVC_User_STL71_RTL X86 ---.msm
If you have performed all these steps correctly you should have the following 6 merge modules added to the setup project.
Crystal_Database_Access2003.msm (latest version included in the download)Crystal_Database_Access2003_enu.msm (latest version included in the download)Crystal_Managed2003.msm (latest version included in the download)Crystal_regwiz2003.msm (latest version included in the download)VC_User_CRT71_RTL_X86_---.msm (already on your machine)VC_User_STL71_RTL X86 ---.msm (already on your machine)
Now select Crystal_regwiz2003.msm in Solution Explorer and view its properties. Find the (MergeModulePropeties) property and expand it. A property called License Key should have appeared. In this property enter the key that you will find in the About dialog under the Help menu in Visual Studio. The key will be 19 characters long and probably look something like AAP50-GS99999-U9999RN. That's it, you can now add the project outputs and contents of your projects to the installer and build it.
You might think that some of the merge modules mentioned earlier do not really apply to your reports. The names of the merge modules are deceiving. Crystal_Managed2003.msm is always required no matter how your reports are built and so is Crystal_regwiz2003.msm because that is the only way to register Crystal Reports on the deployment machine. Crystal_DatabaseAccess2003.msm and Crystal_Database_Access2003_enu.sms apart from drivers for database connectivity they also contain the dlls that allow reports to be exported to other formats such as PDFs and Word documents. If your reports access any ADO.NET datasets then VC_User_CRT71_RTL_X86_---.msm and VC_User_STL71_RTL X86 ---.msm are also required. For (a bit) more information you can read this document.


Exception Details: CrystalDecisions.CrystalReports.Engine.InternalExc eption: Cannot find KeycodeV2.dll, or invalid keycode.

The reason you are getting this error is because the machine that you are trying to run your application on does not contain the drivers Crystal Report needs to run. Here is your solution:Finding Out What the Crystal Report Distribution Key is on VS.NET 2003:1- Open VS.NET 20032- Click on Help Menu Option3- Choose "About Microsoft Development Environment"4- Look under Crystal Reports for Visual Studio .NET, you will see a 19 character number, which is the Distribution Key Code:Example: AAA00-BB00000-C0000DDProducing the Deployment Project:Open Solution Explorer, right click on the “Solution Name” at the top and Add a New Project. On the window that appears, move to Setup and Deployment Projects. Click on Setup Project (not the wizard), put a name for your deployment project (make a note of the location where the folder that the deployment project will be created in) and then click OK. A File System dialog will appear – solution explorer should be displayed on the left of screen. Within solution explorer – right click over your deployment project and select Add – Project Output. Another window will appear – select Primary Output (make sure configuration is showing Active) and click OK. This will result in the detected dependencies being updated & a primary output icon appearing in the deployment project. Right click on the deployment project name again and Add – Merge Modules. Add the following modules.Crystal_Database_Access2003.msmCrystal_Database_Access2003_enu.msmCrystal_Managed2003.msmCrystal_regwiz2003.msmVC_User_CRT71_RTL_X86_---.msmVC_User_STL71_RTL_X86_---.msmThese were the appropriate modules for my application given that I am using VS 2003. Yours may be slightly different. Right click on Crystal_regwiz2003.msm and go to its properties. Enlarge the MergeModuleProperties tree and enter the product licence key.Go onto Build – Configuration Manager . Check that the Project & Deployment Project which appear are set to “Release” and the Build check box for each is checked. Build the Project. If all is well the build should show no errors.If this has gone according to plan you should now have (in the folder specified in the “location” window given when you added your deployment project) a debug and release folder. The release folder will contain:- setup (application)- setup (config file)- an installer packageThe release folder is all that is needed to deploy the application on another machine.Note:

The original source of this tutorial was (http://www.vbcity.com/forums/topic.asp?tid=67989).
DigiOz Multimediahttp://www.digioz.com/

No comments:

Post a Comment