Search code examples
c#winformsxtrareport

XtraReport Show Only First Record


I have created an XtraReport that gets data from a stored procedure:

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

On my form i have this code:

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

When i click on the button to run the report, I wish to show only the first record, help me please.


Solution

  • I'd say that this depends on the layout of this report. Make sure that the XtraReport.DataMember property value is clear if you are binding a report to DataTable. Another cause may be that your report contains the detailreportband which actually displays data bound values. In this case, you need to pass that DataTable to DetailReportBand.DataSource, not to a parent report's DataSource property.