XtraReport仅显示第一条记录

时间:2018-07-14 12:09:57

标签: c# winforms xtrareport

我创建了一个XtraReport,它从存储过程中获取数据:

    public DataTable ProjectRaw()
    {
        DAL.DataAccessLayer DAL = new DAL.DataAccessLayer();
        DataTable dt = new DataTable();
        dt = DAL.SelectData("ProjectRaw", null);
        DAL.Close();
        return dt;
    }

在我的表格上,我有以下代码:

    private void simpleButton1_Click(object sender, EventArgs e)
    {
        XtraRepProjectRaw report = new XtraRepProjectRaw();
        report.DataSource = prd.ProjectRaw();
        report.ShowRibbonPreviewDialog();
    }

当我单击按钮以运行报告时,我只希望显示第一条记录,请帮助我。

1 个答案:

答案 0 :(得分:2)

我要说,这取决于此报告的布局。如果将报表绑定到DataTable,请确保XtraReport.DataMember属性值是清除的。另一个原因可能是您的报告包含detailreportband,它实际显示数据绑定值。在这种情况下,您需要将该DataTable传递给DetailReportBand.DataSource,而不是父报表的DataSource属性。