Hello,
Thank you for the sample code.
Common Data connection
-
- Posts: 6259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Common Data connection
We loop over all the data connections in case the report has more than one source.
And instead of clearing we just overwrite. Not sure if one or other is better practice...would be good to know though.
Something like this:
public void StiWebViewer1_GetReport(object sender, StiReportDataEventArgs e)
{
StiReport report = new StiReport();
report.Load(Server.MapPath("App_Data/Report.mrt"));
foreach (StiSqlDatabase db in report.Dictionary.Databases)
db.ConnectionString = YourConnectionString;
report.Compile();
StiWebViewer1.Report = report;
}
And instead of clearing we just overwrite. Not sure if one or other is better practice...would be good to know though.
Something like this:
public void StiWebViewer1_GetReport(object sender, StiReportDataEventArgs e)
{
StiReport report = new StiReport();
report.Load(Server.MapPath("App_Data/Report.mrt"));
foreach (StiSqlDatabase db in report.Dictionary.Databases)
db.ConnectionString = YourConnectionString;
report.Compile();
StiWebViewer1.Report = report;
}
Re: Common Data connection
Hello,
Your code changes the connection string.
Another sample allows for changing the type of connection.
Thank you.
Your code changes the connection string.
Another sample allows for changing the type of connection.
Thank you.