Bind Reports to Data
- 3 minutes to read
Supported Data Sources
DevExpress Reporting allows you to bind reports to the following data sources:
- SQL Database
- XML File
- Entity Framework
- Business Object
- Excel File
- JSON Data
- MongoDB Instance
- XPO
- Data Federation
- Standard .NET Data Providers
Specify a Data Source in the Visual Studio Designer
Report Wizard
Invoke the Report Wizard to design a report bound to data. The Wizard allows you to select the data source type, create a connection, add queries, and create table relationships.
Data Source Wizard
Use the Data Source Wizard to bind a report to a data source. The Data Source Wizard allows you to select the data source type, create a connection, add queries, and create table relationships.
Note
Do not include dots in the name of a data source (for example, Customers.Products.2014
is incorrect). The report engine uses dots to separate the data source name from query names.
You can invoke the Data Source Wizard in one of the ways described below.
Report Smart Tag
Expand the Data Source combo box and click Add Report Data Source…
Properties Window
Expand the Data Source combo box and click Add Report Data Source…
Report Explorer Window
Right-click the Data Sources (or Components) node and select Add Data Source.
Display Data Fields
The Field List window displays the available data fields after you connect a report to a data source. You can drop fields from the Field List onto the report design surface to create data-aware controls.
Note
Use the Rebuild Result Schema command or call the RebuildResultSchema
method on any changes in the connection, queries, or database structure. The RebuildResultSchema method applies changes to the data source and refreshes fields available for report bindings and fields displayed in the field list.
Reuse the Data Source
You can reuse a report’s data source in other reports. For this, add a report’s data source to the gallery, load another report, and add the data source from the gallery.
Add a data source to the Report Gallery.
Right-click a report’s data source in the Field List window (or Report Explorer window) and select Add to Gallery.
Assign a data source to a report.
Open the Report Gallery window. Right-click the data source in the Data Sources node and select Add to Report Components.
Specify a Data Source in Code
Use the XtraReport.DataSource and XtraReport.DataMember properties to bind a report to the data source.
Process Multiple Data Sources
The DataSourceManager class contains static methods that allow you to retrieve data sources from a report, nested subreports, report controls that use their own data sources, and report parameters.