SSRS datetime parameter prompts in format dd/mm/yyyy throwing error “The value provided for the report parameter ‘StartDate’ is not valid for its type” RRS feed

  • Question

  • I have a system that uses the WinForms report viewer (Microsoft.Reporting.WinForms.ReportViewer ) in a system. The server where the reports are processed uses format MM/dd/yyyy and the system uses dd/MM/yyyy. I can’t change this or the system as both are required to have those settings.

    The issue I’m having is that while the calendar that is created by the report viewer is showing the date as dd/MM/yyyy and entering it into the parameter fields in that format the date is still being parsed as MM/dd/yyyy when the report is run.

    If the date is entered as MM/dd/yyyy or yyyy-MM-dd the report will run but after the dates are parsed they are switched back to displaying in dd/MM/yyyy which then either fails to parse or parses backward if the user attempts to run the report again (E.G first run 10/01/2016 next 01/10/2016). The reports are standard SSRS 2005 reports using SQL Server 2005 stored procedures.

    I’ve set the Language property of the report to =User!Language and while this has caused the calendars to set the date in the correct format the parse is still not working correctly.

    I’m using version of Microsoft.ReportViewer.WinForms and .Net 3.5. I can upgrade one or both if need be. The system is running on Windows 7 64 bit.

    The regional settings for my computer are set to dd/MM/yyyy

    The code I am using to set the report to the reportViewer control is

    reportViewer.ServerReport.ReportServerUrl = Globals.ReportServerLocation
    reportViewer.ServerReport.ReportPath = Globals.ReportPathLocation & bv_strReportName
    reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = New Net.NetworkCredential("USER", "PASSWORD")

    This issue may be related to SSRS 2005 as I have the same issue when running reports in the designer.

    I have found a workaround for the issue by changing the parameters to strings and requiring the users to enter the dates in yyyy-MM-dd or MM/dd/yyyy but I would rather have the calendars working using dd/MM/yyyy if possible.

    Any help you can offer would be appreciated.

    • Edited by Chris234987 Friday, October 28, 2016 2:36 PM
    Friday, October 28, 2016 2:33 PM