Report Viewer Error RRS feed

  • Question

  • Hello I've created a SSRS report that take a parameter. When I run the .rdl it works great. I select the value from the parameter drop-down and it works great. Now I'm trying to build a web client to run the report but my code below says the parameter doesn't exist (line 9). I've verified that the parameter value that I pass in from the drop-down list (line 2) has the correct value.


    Please help a noob! Thanx!


    1. Protected Sub lnkRun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkRun.Click

    2. Dim intPortalId As Integer = DropDownList1.SelectedValue

    3. ReportViewer1.ServerReport.ReportServerUrl = New Uri(ConfigurationManager.AppSettings("Key_ReportServer"))

    4. ReportViewer1.ServerReport.ReportPath = "/AuditsReports/VendorsStatus"

    4. ReportViewer1.ShowToolBar = False

    6. ReportViewer1.ShowParameterPrompts = False

    7. Dim params(0) As ReportParameter

    8. params(0) = New ReportParameter("PortalId", intPortalId, True)

    9. ReportViewer1.ServerReport.SetParameters(params) >> ERROR HERE: Parameter 'PortalId' does not exist on this report <<

    10.  ReportViewer1.ServerReport.Refresh()

    11. End Sub



    Tuesday, June 12, 2007 6:57 PM

All replies

  • Sometimes things are case-sensitive where one might not expect them to be.  I'm not sure if this is one of them -- but just in case, check the casing on your param name.  (FWIW I have a tendancy to type ID when it should be Id and vice-versa ...)


    What happens if you do it this way:

    Code Snippet


            Dim p(0) As ReportParameter

            Array.Resize(p, 1)

            p.SetValue(ReportParameter("PortalId", intPortalId), 0)


    It seems to work for me...



    Wednesday, June 13, 2007 3:11 PM
  • Lisa,


    Thanks for the help. I checked the case and even copied the Parameter name value from the Report Parameter dialog on the report just to be sure. But it still bombs on the SetParameters line with "Parameter 'PortalId' does not exist on this report."


    I also tried replacing my code with yours but I get a syntax error on:


    p.SetValue(ReportParameter("PortalId", intPortalId), 0)

    with "ReportParameter is a type and cannot be used as an expression"


    Any other advice?



    Wednesday, June 13, 2007 4:32 PM
  • hi there,


    Sorry about that -- I copied my code quickly and tried to adapt it to your values and names and missed out a word...


    The .SetValue line should have the keyword New before ReportParameter...


    Code Snippet

    p.SetValue(New ReportParameter("PortalId", intPortalId), 0)


    Can you try again please?  This is really how I do it, honestly <g>.



    Thursday, June 14, 2007 1:16 AM