获取报告FromDate ToDate

时间:2014-02-21 12:28:35

标签: c# devexpress xtrareport

我有问题在特定日期之间获取报告。我想选择PurchaseDate的日期范围,但是当我选择日期范围时,我看到所有购买日期......

    private void barButtonItem1_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
    {

        XtraReport1 report = new XtraReport1();

        // Create a parameter and specify its name.
        Parameter param1 = new Parameter();
        param1.Name = "FromDate:";
        param1.Type = typeof(System.DateTime);

        param1.Description = "FromDate:";
        param1.Visible = true;

        Parameter param2 = new Parameter();
        param2.Name = "ToDate";
        param2.Type = typeof(System.DateTime);

        param2.Description = "ToDate: ";
        param2.Visible = true;

        report.Parameters.Add(param1);
        report.Parameters.Add(param2);

        report.FilterString = "[PurchaseDate] Between(?FromDate,?ToDate)";

        report.RequestParameters = false;

        ReportPrintTool pt = new ReportPrintTool(report);
        pt.AutoShowParametersPanel = true;
        pt.ShowPreviewDialog();
    }

2 个答案:

答案 0 :(得分:0)

我想你需要设置参数的值。

昨天使用它:

param1.Value = DateTime.Now.AddDays(-1);

直到今天:

param2.Value = DateTime.Now;

答案 1 :(得分:0)

我看不到你在哪里设置purchaseDate-Values。我认为你必须设置param1和param2的值属性。