Common Data connection

Stimulsoft Reports.WEB discussion
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Common Data connection

Post by Lech Kulikowski »

Hello,

Thank you for the sample code.
ianwelsh
Posts: 19
Joined: Mon Sep 25, 2017 1:54 pm

Re: Common Data connection

Post by ianwelsh »

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;
}
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Common Data connection

Post by HighAley »

Hello,

Your code changes the connection string.
Another sample allows for changing the type of connection.

Thank you.
Post Reply