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 | Xtra |
A report instance. |
#Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
include |
Boolean | False |
|
#Type Parameters
Name | Description |
---|---|
TData |
The data source type. |
#Returns
Type | Description |
---|---|
IEnumerable<TData |
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