1
votes

I created a report and deployed on Reporting Services Server. This report is populated using a stored procedure which receives an input parameter: @RecordID.

In the report also, I added a variable with the name RecordID.

In my Visual Studio project, I added Report Viewer control and set the path of the server report. When I open this report on Web Page, it displays error:

Parameter 'RecordID' does not exist on this report

The code in the code-behind file is:

   protected void Page_Load(object sender, EventArgs e)
    {
        Microsoft.Reporting.WebForms.ReportParameter Param = new Microsoft.Reporting.WebForms.ReportParameter("RecordID","3");
        ReportViewer1.ShowParameterPrompts = false;
        ReportViewer1.ServerReport.SetParameters(Param);
        ReportViewer1.ServerReport.Refresh();
    }

Edited

I added a variable using Report Properties in Business Development Studio. Below is the image. This variable is set to receive value of the parameter.

enter image description here

1
You said you added Variable on the Report is it a parameter you have added? Does the Report run by it self on the Reporting server. DO you have the option to set the Parameter when you run the Report? - bhupendra patel
Check twice your report (what if ShowParameterPrompts is true and no params provided). If you added a parameter with name RecordID then it must be there... - Adriano Repetti
If I am not passing parameter using code-behind, it prompts for parameter value. - RKh
@bhupendrapatel Yes the variable is set to have parameter value. - RKh
What does GetParameters return? My thought is you initialise the report later than this and the report viewer doesn't know about them yet. - Mike Miller

1 Answers

1
votes

In this image you see the steps to add a new parameter and to link it to the Dataset.