none
An attempt was made to set a report parameter 'mydate1' that is not defined in this report." RRS feed

  • Question

  • Hello Community

        In and earlier version of VS when you created an rdlc on the Toolbar there was a selection named "Report" where you were allowed to enter the name and type of a report parameter you were passing from a report form containing a ReportViewer control.

        I am using VS 2013 so the problem I am having is that when the form containing the ReportViewer control calls the rdlc, the codebehind fails during the parameters code in the codebehind as such:

                ReportParameter[] myparms = new ReportParameter[2];
                parm1[0] = new ReportParameter("mydate1", fromDate.ToString());
                parm2[1] = new ReportParameter("mydate2", toDate.ToString());
                this.reportViewer1.LocalReport.SetParameters(myparms);
                this.reportViewer1.RefreshReport();

        The actual line that fails is: this.reportViewer1.LocalReport.SetParameters(myparms)and the error says:

    Exception:Thrown: "An attempt was made to set a report parameter 'mydate1' that is not defined in this report." (Microsoft.ReportingServices.Diagnostics.Utilities.UnknownReportParameterException)

        My questions are:
           
            1) In VS2013 how do you create an rdlc that will be called by a form that has a ReportViewer control and will be passing a parameter?

            2) What does the error mean when it says an "attempt" was made to set a report parameter mydate1 that is not defined in this report (the code shown is the same way I coded the codebehind in earlier versions and those reports worked the only difference was that I dragged a TableAdapter on the form containing the ReportViewer and in vs2013 I am using a dataset as the datasource)?

         Thanks
         Shabeaut

      



    • Edited by Shabeaut Tuesday, March 8, 2016 9:56 PM
    Tuesday, March 8, 2016 9:55 PM