I have a remote SSRS 2016 server with some reports uploaded. These reports are to be shared by the Dev, QA and Production environments.
The way I do this is by having a DataSource with a dynamic connection string using an expression:
="Data Source="& Parameters!DatabaseServer.Value &
";Initial Catalog="& Parameters!DatabaseName.Value
The db name and sql server address are passed in a parameters from an MVC project view.
ReportParameter p1 = new ReportParameter("UserId", CurrentUserId, false);
ReportParameter p2 = new ReportParameter("DatabaseServer", ReportDbServer, false);
ReportParameter p3 = new ReportParameter("DatabaseName", ReportDb, false);
var params = new ReportParameter[] { p1, p2, p3 };
reportViewer.ServerReport.SetParameters(param);
This exception is thrown on the SetParameters
call:
ReportServerException: Error during processing of the ConnectString expression of data source ‘dsDynamic’. (rsDataSourceConnectStringProcessingError)
2 additional points:
- In another older project, this dynamic Datasource approach works, albeit using MVCReportViewer (https://www.nuget.org/packages/MvcReportViewer/)
- In this project, the report renders if I change the expression-based connection string to the vanilla "Data Source=127.0.0.1;Initial Catalog=AdventureDB" type.
Has anyone here ever used this dynamic conn string approach with success using ReportViewer?