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:
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
takesIEnumerable<ReportParameter>
(usually aList
), not just a singleReportParameter
object. You need to embed the parameter into anIEnumerable
object. Here is a simple way to do it in one line of code: