views:

127

answers:

0

I have visual studio 2008 and I am designing a web site that is using the report viewer in local mode. The language that I am using is VB. I created a report using the wizard and I am using a stored procedure in SQL2008 that takes in two parameters (two date type parameters: startdate and enddate). In the wizard, the following is how I set up the parameters:

Configure Data Source: Define Parameters

Name

startdate

Value

DateOneBox.Text

Parameter Source:

Control

ControlID:

DateOneBox

Name

enddate

Value

DateTwoBox.Text

Parameter Source:

Control

ControlID:

DateTwoBox

In my aspx page, I have ReportViewer1 and two text boxes (DateOneBox and DateTwoBox) and a button that has the following code:

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    try        
      Dim sDate As New ReportParameter("startdate", CType(DateOneBox.Text, Date))
      Dim eDate As New ReportParameter("enddate", CType(DateTwoBox.Text, Date))

      ReportViewer1.LocalReport.SetParameters(New ReportParameter() {sDate, eDate})
      ReportViewer1.LocalReport.Refresh()
    Catch ex As Exception
            DateOneBox.Text = ex.ToString()
    End Try
End Sub

When I click the button the data is not being displayed and I receive the following error message: Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.Diagnostics.Utilities.UnknownReportParameterException: An attempt was made to set a report parameter 'startdate' that is not defined in this report. --- End of inner exception stack trace --- at Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable`1 parameters) at NPPDashboard_Reports_JoannReports_TopProductSales.Button1_Click(Object sender, EventArgs e)