Tuesday, December 19, 2006

Crystal Version 9.0 - Demystified

My earlier post was about the issues with Crystal. I guess I'm fairly clear now. For the sake of the unfortunate IT folks who struggle with Crystal Reports here is my understanding of the product.

1. There are two flavors of Crystal Reports (even with-in Crystal 9.0). One is the full version where you get to design the reports with Crystal and the other one is a stripped down version where you design in Visual Studio.NET environment.

2. If you developers build the reports either way, you have the option of delivering the all the dependent Crystal binaries along with your application. Again, you have the two options. One: Build an installable with merge modules downloaded from Business Objects web-site. Two: Have users download the redistributable available on Business Objects web-site. Either way, you need to pass the key code to your users. In case of merge modules, the key-code must be specified as a property of the license.msmx. In case of redistributable, the key-code of your Crystal registration must be used at the time of installation. I'm sure Crystal validates the key-codes against the product versions mentioned in the earlier point.

3. Another issue that vexes the users is the login information. Developers are often insensitive to the differences between the development and production environments. The login information gets saved with the crystal report and Crystal is known for using this information inappropriately. Check out the documentation on the 68MB service packs Business Objects offers for Crystal Reports.

To prevent Crystal from using the login information stored with the report, it must be passed explicitly to the report at run-time. The sample code is as follows:

TableLogOnInfo logOnInfo = new TableLogOnInfo ();
int i = 0;

// Loop through every table in the report.
for (i=0;i == myReportDocument.Database.Tables.Count - 1;i++)
// Set the connection information for the current table.
logOnInfo.ConnectionInfo.ServerName = db_server;
logOnInfo.ConnectionInfo.DatabaseName = db_dbname;
logOnInfo.ConnectionInfo.UserID = db_user;
logOnInfo.ConnectionInfo.Password = db_pwd;
myReportDocument.Database.Tables [i].ApplyLogOnInfo (logOnInfo);

No comments: