在 XtraReport 中访问存储过程值

Access stored procedure value within XtraReport

在我的表单中,我有以下代码可以通过单击按钮打开我的报告:

private void btnGroupOther_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
    LayoutControl lc = new LayoutControl();
    lc.Dock = DockStyle.Fill;
    DateEdit FirstDate = new DateEdit();
    DateEdit LastDate = new DateEdit();
    lc.AddItem(Resources.firstdate, FirstDate).TextVisible = true;
    lc.AddItem(Resources.seconddate, LastDate).TextVisible = true;
    lc.Height = 70;
    this.Controls.Add(lc);
    this.Dock = DockStyle.Top;
    if (DevExpress.XtraEditors.XtraDialog.Show(lc, " ", MessageBoxButtons.OKCancel) == DialogResult.OK)
    {
        RepProductionGroupOther report = new RepProductionGroupOther();
        report.DataSource = paint.RepProductionGroupOther(Convert.ToDateTime(FirstDate.EditValue).ToString("MM/dd/yyyy"),
            Convert.ToDateTime(LastDate.EditValue).ToString("MM/dd/yyyy"));

        report.ShowRibbonPreviewDialog();
    }
}

在我的 header 报告中,我有两个 xrLabel;第一个 txtFirstDate 和第二个 txtLastDate。我想在 txtFirstDate 中显示 FirstDate DateEdit 控件的值,在 txtLastDate.[=30= 中显示 LastDate DateEdit 控件的值]

我该怎么做,报表的数据源是sql存储过程。
它有两个参数:@FirstDate@LastDate.

提前致谢

我建议您阅读 XtraReport 文档:
Request and Pass Report Parameter Values

private void button1_Click(object sender, EventArgs e) {
    // Create a report instance. 
    XtraReport1 report = new XtraReport1();

    // Obtain a parameter and set its value. 
    report.Parameters["parameter1"].Value = 30;

    // Hide the Parameters' UI from end-users (if you did not hide it at design time). 
    report.Parameters["parameter1"].Visible = false;

    // Show the report's print preview depending on your target platform. 
    // ... 
}

检查上面文档中的 "Custom Parameter Editors" 部分 参数的自定义编辑器实现因应用程序的平台而异:

下面是您尝试执行的类似实现。检查这些,希望这能帮助您解决问题。

DevExpress XtraReport Setting a DateTime Parameter to Today

Passing parameters to Xtrareports repx file