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.
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:
Create a new application or open an existing application.
- Add a new blank report to it.
Add a DetailReport band to the report. Right-click the report's Detail band and select Insert Detail Report / Unbound from the context menu.
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
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.
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).
The detail report is now bound to the data.
Create another DetailReport band. Repeat the same steps as above to bind it to another data source (the Northwind database's Suppliers table).
You can bind the second DetailReport band to a different database.
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.
Drop data fields from the Field List onto the created bands.
The report is ready. Switch to the Preview tab and view the result.