title: SSRS ReportViewer in MVC not passing parameters to DataSource
body: <p>I have a remote SSRS 2016 server with some reports uploaded.
  These reports are to be shared by the Dev, QA and Production environments.</p>
  
  <p>The way I do this is by having a DataSource with a dynamic connection string using an expression:</p>
  
  <pre><code>="Data Source="&amp; Parameters!DatabaseServer.Value &amp; 
  ";Initial Catalog="&amp; Parameters!DatabaseName.Value
  </code></pre>
  
  <p>The db name and sql server address are passed in a parameters from an MVC project view.</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>This exception is thrown on the <code>SetParameters</code> call:</p>
  
  <blockquote>
    <p>ReportServerException: Error during processing of the ConnectString
    expression of data source ‘dsDynamic’.
    (rsDataSourceConnectStringProcessingError)</p>
  </blockquote>
  
  <h2>2 additional points:</h2>
  
  <ol>
  <li>In another older project, this dynamic Datasource approach works,
      albeit using MVCReportViewer (<a href="https://www.nuget.org/packages/MvcReportViewer/" rel="nofollow noreferrer">https://www.nuget.org/packages/MvcReportViewer/</a>)</li>
  <li>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.</li>
  </ol>
  
  <p>Has anyone here ever used this dynamic conn string approach with success using ReportViewer?</p>