Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing servers at runtime Crystal Reports

Status
Not open for further replies.

Stephengb

Programmer
May 22, 2002
5
CA
• My reports all work on the development machine using the development data.
• I do a build and install on the target machine from the code generated on the development machine.
• I do a complete data backup from the development server and restore to the target server
• The reports will not function on the target machine.
• I copy the entire Visual Studio environment to the target machine.
• I run the build exe and the report still fails.
• I open a report in Visual Studio in design mode and issue verify database. NOTE IT ASKS FOR THE SERVER NAME!
• I close the report and rebuild just that project from the solution.
• I copy the new dll to the main project and run the main exe again.
• The report now works.

My connection information for my Ole Db connection is contained in a public properties class.

It is the same connection used throughout and the application will not start without that connection.

On each form which contains the Crystal Report Viewer, for the report that is to be run, I execute the following code (the same code in both environments):

Crystal reports code goes like this and it does not work!

// Set the runtime configuration for the database for the report
private void SetDBLogonForReport(ReportDocument reportToRun)
{
CrystalDecisions.Shared.ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.IntegratedSecurity = DmsPublics.IntegratedSecurity;
connectionInfo.DatabaseName = DmsPublics.DBName;
connectionInfo.ServerName = DmsPublics.DBServer; ;
if (DmsPublics.IntegratedSecurity.ToString().ToLower().Trim() == "false")
{
connectionInfo.UserID = DmsPublics.DbUser;
connectionInfo.Password = DmsPublics.DBPassword;
}

Tables tables = reportToRun.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
tableLogOnInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogOnInfo);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top