Bind a Report to Multiple Data Sources
- 3 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. For more information, review the following help topic: Get Started with DevExpress Reporting.
- 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.
If your project in Visual Studio 2022 has to connect to Microsoft Access databases, note that Visual Studio 2022 is a 64-bit process, and Microsoft OLE DB Provider for Jet and the Jet ODBC driver are only available in 32-bit versions. It is recommended that you use the 64-bit Microsoft Access Database Engine (Access Connectivity Engine, ACE), or use an earlier version of Visual Studio (VS 2019) that supports 32-bit database providers. For more information, review the following article: Connect to data in an Access database.