I cannot get any of the following to work for me:
- Change Report ConnectionString at Runtime
- DataSource Configuration / ConnectionString
- Change Connection String for Reports Designed in Standalone Designer
I have a WPF project that contains several Telerik Report Q3 2013 objects. The reports also have parameters and they preview just fine. During runtime, each report runs a query that fetches data from a SQL Server database and displays the results in the reports.
The WPF app has a menubar. At runtime, a user can go to the Reports menu, and choose to preview Report1, Report2, or Report3. There is a WPF window that hosts a report viewer control (called RptViewer). When the code behind a menu option executes, such as the Report3 menu option, the code basically does the following:
private void mnuReports_View_Report3_Click(object sender, RoutedEventArgs e) {
InstanceReportSource irSrc = new InstanceReportSource();
RptViewer winRptView = new RptViewer();
irSrc.ReportDocument = new Report3();
winRptView.rptViewer.ReportSource = irSrc;
winRptView.Show();
}
This all works fine and the correct report is previewed every time. My problem is that each report stores a static connection string.
I intend for some of my clients to install and use this WPF app within their own network. The reports will need to access the data within their own SQL Server databases. So I need the connection strings to be updated accordingly. We already have the correct connection strings; we just need the string to be assigned to a report whenever it is loaded by the report viewer. I don’t know why I can’t get this to work.