Just setting the ConnectionInfo doesn't seem to do the trick. Here's the code we use inside the foreach loop to do this:
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
Also, does your report have subreports? If so, you also have to set their login info as well:
private void SetDBLogonForSubreports
(CrystalDecisions.Shared.ConnectionInfo connectionInfo,
ReportDocument reportDocument,
string qServer)
{
Sections sections = reportDocument.ReportDefinition.Sections;
foreach (Section section in sections)
{
ReportObjects reportObjects = section.ReportObjects;
foreach (ReportObject reportObject in reportObjects)
{
if (reportObject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject subreportObject = (SubreportObject)reportObject;
ReportDocument subReportDocument = subreportObject.OpenSubreport(subreportObject.SubreportName);
SetDBLogonForReport(connectionInfo, subReportDocument, qServer);
}
}
}
}
-Dell