Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

Sub Report can't resolve relitave path

$
0
0

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:

 

 

CR_DB_Dialog.png

 

 

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.





Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>