Click to See Complete Forum and Search --> : Crystal Reports Login via Application


eplum_2003
September 3rd, 2004, 05:42 PM
Hi there,

I have a .NET Managed C++ desktop application that is designed to display reports in an MDI interface. Only certain reports can be selected for viewing, I have previously created these reports using Crystal Reports 10.0. The reports were created using an ODBC interface to an MS SQL database.

For simplicity, lets say I have a report called SampleReport.rpt. When the user selects to view this report, the application sets two components to the CR interface;

crystalviewer->ReportSource = "C:\SampleReport.rpt" // The report path
crystalViewer->LogOnInfo = ConnInfo; // The Login info

ConnInfo->ServerName = DSN; // Login info that was
ConnInfo->DatabaseName = Database; // gathered previously from
ConnInfo->UserID = UserName; // the user.
ConnInfo->Password = UserPswd;


If the user's login matches the Database that the report was created with everything works fine. For example, if the report was created using a DSN called "DSN1" that uses tables from "Database1" and the user enters this same information to the application, then the report displays as expected.

In the case that fails, I have a different database with the same schema (but different values) called "Database2" and it is aliased via "DSN2". If the user enters the this information at the application login and then attempts to view the same "SampleReport.rpt", the values from "Database1" are displayed in the report.

It basically appears that the CR interface will always reference the database that it is created with, rather than using the database that the application passes to it.


Has anyone encountered this before?
Thanks for any help...