Question

i have problem to get report between specific date. I wanna choose the date range for PurchaseDate but when i choose date range i saw all purchase date...

    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();
    }

No correct solution

OTHER TIPS

I guess you need to set the value of the parameters.

Use this for yesterday:

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

Until today:

param2.Value = DateTime.Now;

I cannot see where you set the purchaseDate-Values. I think you have to set the Value-Properties of param1 and param2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top