Bind a Report to Multiple Data Tables

  • 2 minutes to read

This tutorial illustrates the capability to include data from two (or more) non-linked data tables into a single report.


In this tutorial, the data tables are obtained from the same data source. To learn how to bind a report to different data sources, see Bind a Report to Multiple Data Sources.

To display multiple data tables in the same report document, do the following.

  1. Create a new application or open an existing application. For more information, review the following help topic: Get Started with DevExpress Reporting.

  2. Add a new blank report to it.
  3. Add a dataset to the project, which uses two non-linked tables, e.g., the “Employees” and “Products” tables of the sample Northwind database.



    Make sure that data source of the report itself is not assigned. If it is not empty, you should manually reset the report’s XtraReportBase.DataSource and XtraReportBase.DataMember properties, since similar properties are to be assigned individually for the DetailReportBands.

  4. To add a DetailReportBand instance, right-click the Detail report band, and select Insert Detail Report | Unbound in the invoked popup menu.

    HowTo - BindReportToDifferentDataSources_0

  5. Next, assign a data source to the created Detail Report. To do this, click the Detail Report’s smart tag, and in the invoked actions list, set the DataSource property to the required data source.


  6. Likewise, define the band’s XtraReportBase.DataMember property to the “Employees” data table.


  7. Right-click the Detail report band and select Insert Detail Report | Unbound in the invoked popup menu to create another DetailReportBand at the same level as the first Detail Report. Do not right-click on the previously created Detail Report band and select Insert Detail Report, because this creates the Detail Report nested, one level lower.


  8. To force a page break between Detail Reports, set the Band.PageBreak property of the first DetailReportBand to AfterBand.


  9. Finally, drag-and-drop the required data fields from the appropriate tables in the Field List onto the respective bands to create the bands’ actual content. For example:



    In the above image, the XRLabel in the first Detail Report is used to display data from two fields simultaneously. To do this, refer to the Letters tutorial.

The report is now ready. Switch to the Preview tab and view the result.


See Also