simplified code is as follows:
ReportDocument MainReport = new ReportDocument();
MainReport .Load(ReportFile);
MainReport.SetDataSource(DataTable);
MainReport.VerifyDatabase();
[...]
ReportDocument SubReportDocument= MainReport.OpenSubreport(SubReportName);
SubReportDocument.SetDataSource(SubDataTable);
SubReportDocument.VerifyDatabase();
When displaying in the viewer I receive the connection dialog.
As a work around I trued changing the Database.ConnectionInfo to a static Path by doing the following prior to setting the DataSource:
TableLogOnInfo T = SubReportDocument.Database.Tables[0].LogOnInfo;
T.ConnectionInfo.LogonProperties[0] = new NameValuePair2("Field Definition File", x);
T.ConnectionInfo.ServerName = x;
T.ConnectionInfo.IntegratedSecurity = true;
SubReportDocument.Database.Tables[0].LogOnInfo.ConnectionInfo.Attributes.Collection[4] = new NameValuePair2("QE_ServerDescription", x);
SubReportDocument.Database.Tables[0].ApplyLogOnInfo(T);
Though on ApplyLogOnInfo it reset the path back to ".\\Cert_WorksetSpecialText.ttx". Not using the ApplyLogOnInfo did not have any noticeable effect either. I had read somewhere that setting the location after ApplyLogOnInfo would do the trick, so I tried:
SubReportDocument.Database.Tables[0].Location = T.TableName;
This only created an "Connection not possible" error in VS.
I cannot change the RPT files, since our current system required the dynamic pathing in the existing files, and I am only replacing one part of the system which was based on VB 6.0 and a much older version of CR (which stopped working after a server update).
I am currently using the latest update (13.0.16.1954) and tried an earlier v13 as well.
And suggestions or help would be much appreciated.
Thanks in advance.
Edited by Morfigle - 09 Feb 2016 at 10:46pm
