Posted 22 October 2019, 3:21 am EST
We have RPX files that in turn have SubReports on them. Both the main report and the sub-report need to have the same connection string. Currently, we are saving the connection string in the main report’s UserData. That works fine, until the server is upgraded and it now has a new name. Now, we have to go into every report to change the server name in the connection string stored in the UserData.
How, via C# script, can i get the current connection string being used for the main report, so i can inturn use it for the sub report.
Current C# script:
string connstring=rpt.UserData.ToString();
string strsql = “SELECT * FROM CustList”;
GrapeCity.ActiveReports.Data.SqlDBDataSource m_ds = new GrapeCity.ActiveReports.Data.SqlDBDataSource();
m_ds.ConnectionString = connstring;
m_ds.SQL = strsql;
GrapeCity.ActiveReports.SectionReport rptSub1 = new GrapeCity.ActiveReports.SectionReport();
rptSub1.LoadLayout(“…\format\rCustList.rpx”);
rptSub1.DataSource = m_ds;
((SubReport)rpt.Sections[“gList”].Controls[“sub1”]).Report = rptSub1;