Skip to main content
All docs
V24.2

DataSourceManager.GetDataSources<TDataSource>(XtraReport, Boolean) Method

Returns all report data sources of the specified type.

Namespace: DevExpress.XtraReports

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public static IEnumerable<TDataSource> GetDataSources<TDataSource>(
    XtraReport report,
    bool includeSubReports = false
)
    where TDataSource : class

Parameters

Name Type Description
report XtraReport

A report instance.

Optional Parameters

Name Type Default Description
includeSubReports Boolean False

true to include data sources from subreports; otherwise, false.

Type Parameters

Name Description
TDataSource

The data source type.

Returns

Type Description
IEnumerable<TDataSource>

A collection of report data sources.

Example

The following code template shows how to use the GetDataSources method to retrieve all data sources of the SqlDataSource type and update their query parameters.

using DevExpress.DataAccess.Sql;
using DevExpress.XtraReports;
//...

var report = new XtraReport1();

var sqlDataSources = DataSourceManager.GetDataSources<SqlDataSource>(
    report: report,
    includeSubReports: true
);

foreach (var sqlDataSource in sqlDataSources) {
    foreach (var query in sqlDataSource.Queries) {
        query.Parameters["paramName"].Value = 32;
    }
}
See Also