DataSourceManager.GetDataSources<TDataSource>(XtraReport, Boolean) Method
Returns all report data sources of the specified type.
Namespace: DevExpress.XtraReports
Assembly: DevExpress.XtraReports.v25.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 |
|
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;
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetDataSources<TDataSource>(XtraReport, Boolean) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.