DataSourceManager.GetDataSources(XtraReport, Boolean) Method
Returns all report data sources.
Namespace: DevExpress.XtraReports
Assembly: DevExpress.XtraReports.v24.1.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
public static IEnumerable<object> GetDataSources(
XtraReport report,
bool includeSubReports = false
)
Parameters
Name | Type | Description |
---|---|---|
report | XtraReport | A report instance. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
includeSubReports | Boolean | False |
|
Returns
Type | Description |
---|---|
IEnumerable<Object> | A collection of report data sources. |
Example
The following code sample shows how to get all report data sources (except for subreport data sources), iterate through these data sources, and update settings (the ConnectionName property) of each data source whose type is SqlDataSource
.
using DevExpress.DataAccess.Sql;
using DevExpress.XtraReports;
//...
var report = new XtraReport1();
var dataSources = DataSourceManager.GetDataSources(report, includeSubReports: false);
foreach (var dataSource in dataSources) {
if (dataSource is SqlDataSource) {
(dataSource as SqlDataSource).ConnectionName = "nwind";
}
}
See Also