=== Crystal Reports 2008 (12.1.0.892) + Visual Studio 2008 C# 9.0.30729.1SP ===
I wrote the source in C# to use it as a wrapper in Sybase PowerBuilder. But that's not the point. The login process fails in C#, if the dsn, server name and database name is different. The application shows a logon dialog or a error message "Fehler beim Öffnen der Verbindung <Reportname.rpt". (don't know the english version but its like "Error opening connection")
TableLogOnInfo crTableLogOnInfo;
ConnectionInfo crConnectionInfo;
ReportDocument crReportDocument;
crReportDocument = new ReportDocument();
crReportDocument.Load("d:\report.RPT");
crReportDocument.Refresh();
crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "ge";
crConnectionInfo.Password = "en";
foreach (Table crTable in crReportDocument.Database.Tables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
crReportDocument.DataSourceConnections.Clear();
crReportDocument.DataSourceConnections[0].SetConnection("ge", "crtest", "en", "en");
uc_crystalViewer1.ReportSource = crReportDocument;
uc_crystalViewer1 is the visual user control in this case.
Is there any workaround or fixes? Is the way to get a connection right?
TIA
Gerrit Edzards