Sub Report can’t resolve relitave path
I’ve been having an issue where a sub report has a TTX file as a database with a relative path (“.\\Cert_WorksetSpecialText.ttx””). Unfortunately when I open it in the Viewer I receive the Database connection Dialog for that file. If I use hard coded paths for the file it works fine. Also the Main reports TTX has a relative path, and it does not cause any issues.
simplified code is as follows:
ReportDocument MainReport = new ReportDocument();
ReportDocument SubReportDocument= MainReport.OpenSubreport(SubReportName);
When displaying in the viewer I receive:
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.LogOnInfo;
T.ConnectionInfo.LogonProperties = new NameValuePair2(“Field Definition File”, x);
T.ConnectionInfo.ServerName = x;
T.ConnectionInfo.IntegratedSecurity = true;
SubReportDocument.Database.Tables.LogOnInfo.ConnectionInfo.Attributes.Collection = new NameValuePair2(“QE_ServerDescription”, x);
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.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 (18.104.22.1684) and tried an earlier v13 as well.
And suggestions or help would be much appreciated.
Thanks in advance.