Parameter validation failed. It is not possible to provide valid values for all parameters. (rsParameterError) SSRS 2008

reporting-servicesssrs-2008

I am passing the parameter from aspx page to report server and getting this exception. Here is my code to set the report parameters.

ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://zeeshankhatri-p/ReportServer_MSSQLSERVER2012");
ReportViewer1.ServerReport.ReportPath = "/DBAReporting/Clients";

ReportParameter p = new ReportParameter();
p.Name = "clientName";
p.Values.Add("Bank Alfalah");

ReportViewer1.ServerReport.SetParameters(p);

here are Parameter Properties:

Select Parameter Visibility = Internal

Allow Blank Value = checked

Allow null Value = checked

Available Values = None

Default Values = No default value

DataSet Properties:

Query:

Query Type = Stored Procedure

Parameters:

Parameter Name = @clientName

Parameter Value = [@clientName]

Can you please suggest what i did wrong in my case.?

Best Answer

There are a number of issues that may cause this:

  • The parameter Available Values query when run in this way contains no entries so you can't assign a valid value
  • The parameter is hidden and can't be assigned to in this way. Check report parameter settings on the server and adjust if needed.
  • You have made some changes to the parameter to the report in development that aren't being deployed to the report server. Note that certain parameter attributes, like default value, aren't overwritten when a report is re-deployed so that server settings aren't lost. Open the report settings and check report parameter settings on the server to make sure they match what you have in development.

It may be easier to delete the server report and deploy again to reset back to the development report settings.

You are also trying to pass a single parameter object to a function that allows you to pass many parameters.

SetParameters takes IEnumerable<ReportParameter> (usually a List), not just a single ReportParameterobject. You need to embed the parameter into an IEnumerable object. Here is a simple way to do it in one line of code:

ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { p });
Related Topic