Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sub Report can't resolve relitave path Post Reply Post New Topic
Author Message
Morfigle
Newbie
Newbie
Avatar

Joined: 07 Feb 2016
Location: Germany
Online Status: Offline
Posts: 1
Quote Morfigle Replybullet Topic: Sub Report can't resolve relitave path
    Posted: 09 Feb 2016 at 10:45pm
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();
     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
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.