RDLC Report: Apply Filter to Report

后端 未结 1 1325
感情败类
感情败类 2021-01-22 14:12

I have two parameters dateFrom and dateTo which I want to filter my report based on those values and show sum of total column of filtered

相关标签:
1条回答
  • 2021-01-22 14:56

    You should apply the filter on the data source of your report, for example:

    invoice_viewTableAdapter.Fill(this.db_posDataSetInvoice.invoice_view);
    this.invoice_viewBindingSource.Filter = "Put your filter here";
    reportViewer1.RefreshReport();
    

    Supposing you have a MyDateField field and you have dateFrom and dateTo of type of DateTime.

    This can be your date filter:

    String.Format("MyDateField>= #{0:yyyy/MM/dd}# AND MyDateField<= #{1:yyyy/MM/dd}#"
                  , dateFrom, dateTo);
    

    you can find more information about about BindingSource.Filter expression syntax here.

    0 讨论(0)
提交回复
热议问题