Pass Two Date Parameters to a Reporting Services report RRS feed

  • Question

  • User-1955664820 posted

    Hi Everyone,

    I'm trying to pass two date parameters to a Reporting Services report. On the first aspx page, the user selects begin date and end date parameters. Next, I have a linkbutton on that page that when clicked creates a query string and redirects to the page with the Reporting Services report on it. My problem is that I can't pass the date parameters to the report directly. What is happening is the page opens and has the two date parameter boxes (Begin Date and End Date) which are empty - prompting you to re-enter the dates. If I select dates from the calendar icon and click View Report, then the report runs fine however want to avoid this step. I want the dates to pass directly to the report and run via the query string. The date format when selected on the first page is: 'mm/dd/yyyy'.

    Here is my code on the sending page:

    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

    Dim targetURL As String

    Dim dtStartDate As Date

    Dim dtEnddate As Date

    dtStartDate = Me.txtBeginDate.Text

    dtEnddate = Me.txtEndDate.Text

    targetURL = "rptUpdateToHP3000.aspx?"

    targetURL &= "SearchByBeginDate=" & Server.UrlEncode(dtStartDate)

    targetURL &= "&SearchByEndDate=" & Server.UrlEncode(dtEnddate)


    End Sub

    This is what my query string looks like on the receiving page:



    Does anyone know how to get this working correctly? Any help is appreciated.


    Wednesday, June 29, 2011 3:07 PM


  • User-830595639 posted


    You just need to provide default value to both the parameter in your Report, and it should work as you are expecting.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 30, 2011 7:27 AM