Bind a Report to Multiple Data Sources

  • 2 minutes to read

You can bind the following report elements to data sources other than the report's data source:

This topic demonstrates how to bind two DetailReport bands to different data sources.

TIP

See Bind a Report to Multiple Data Tables for information on how to bind a report to multiple non-related tables from the same data source.

To bind a report to different data sources, do the following:

  1. Create a new application or open an existing application.

  2. Add a new blank report to it.
  3. Add a DetailReport band to the report. Right-click the report's Detail band and select Insert Detail Report / Unbound from the context menu.

    HowTo - BindReportToDifferentDataSources_0

  4. Bind the added band to a data source. Click the band's smart tag, expand the Data Source drop-down list, and click Add Report Data Source

    HowTo - BindReportToDifferentDataSources_1

    The invoked Data Source Wizard guides you through the process of assigning the data source to the band. These steps are similar to the ones described in the following topic: Bind a Report to a Database.

  5. In this example, the DetailReport band is bound to the Employees table from the sample Northwind database (the nwind.mdb file included in the XtraReports installation).

    When the steps above are performed, the DetailReport band's DataSource property is set to sqlDataSource1. Set the band's DataMember property to the dataset's Employees table.

    HowTo - BindReportToDifferentDataSources_2

    The detail report is now bound to the data.

  6. Create another DetailReport band. Repeat the same steps as above to bind it to another data source (the Northwind database's Suppliers table).

    NOTE

    You can bind the second DetailReport band to a different database.

  7. In this example, you do not need to show any data in the Detail band. Set the band's Visible property to False to hide it.

  8. Drop data fields from the Field List onto the created bands.

    HowTo - BindReportToDifferentDataSources_3

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

HowTo - BindReportToDifferentDataSources_4