Filtering between 2 dates in reportviewer: Whats wrong with my code? RRS feed

  • Question

  • I am trying to filter between between two date on my report viewer. But i get the following error: (An unhandled exception of type 'Microsoft.Reporting.WinForms.LocalProcessingException' occurred in Microsoft.ReportViewer.WinForms.dll) and (Additional information: An error occurred during local report processing) when i used the code below. I have double checked the parameters in the report and all four parameters exist. I tried excluding the dates filter and the filtering worked perfectly but when i include them I get that error. What seems wrong with the date filtering?

     Dim Id As New ReportParameter("Id", txtMemberID.Text)
            Dim Year As New ReportParameter("Year", cmbYear.Text)
            Dim FromDate As New ReportParameter("Date", dtpFrom.Value)
            Dim ToDate As New ReportParameter("Date", dtpTo.Value)
            repvwTitheMemDuration.LocalReport.SetParameters(New ReportParameter() {Id})
            repvwTitheMemDuration.LocalReport.SetParameters(New ReportParameter() {Year})
            repvwTitheMemDuration.LocalReport.SetParameters(New ReportParameter() {FromDate, ToDate})

    Wednesday, November 28, 2018 2:11 PM

All replies

  • Perhaps the issue is with the time part used from the DateTimePickers. 

    Try using, same goes for dtpTo


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 28, 2018 3:37 PM
  • Thanks Karen,

    I have tried your suggestion but it still gives me the same error information. points to this line of code as the one with the error. That was where the error was even before i tried your suggestion. And it the same error. What might be the problem?

     repvwTitheMemDuration.LocalReport.SetParameters(New ReportParameter() {FromDate, ToDate})

    Wednesday, November 28, 2018 4:22 PM
  • Hi Karen,

    I have been going through the codes and when i tried using the code (dtpTo.Value.Date) below for a single date search it worked perfectly. But when i add 2 dates parameter the earlier error pops out. Based on your expertise what do you think?


    Dim FromDate As New ReportParameter("FromDate", dtpTo.Value.Date)
            Dim Year As New ReportParameter("Year", cmbYear.Text)
                repvwTitheReportDates.LocalReport.SetParameters(New ReportParameter() {FromDate})
                repvwTitheReportDates.LocalReport.SetParameters(New ReportParameter() {Year})
    Wednesday, November 28, 2018 5:16 PM