Populates the SqlDataSource in an asynchronous manner.
A task that populates the data source.
Use this method to populate an SQL data source in an individual task asynchronously. Unlike the Fill() method call, FillAsync does not lock other actions performed concurrently. For instance, the user interface remains operational while the data source is populated.
Call the FillAsync method with the await operator.
All queries are validated one by one. If any validation errors occur, an AggregateException is thrown with these errors. Use the exception's InnerExceptions property to access a collection of QueryExecutionException objects (use their InnerException property to access an actual ValidationException).
If the validation succeeds, all queries are executed one by one. If any errors occur, an AggregateException is thrown with these errors. Use the exception's InnerExceptions property to access a collection of QueryExecutionException objects (use their InnerException property to access an actual DevExpress.DataAccess.Native.Sql.SqlExecutionException).
To validate and execute only specific queries, use a FillAsync method overload that accepts the queriesToFill parameter.
The code sample below creates an SqlDataSource and populates it in an asynchronous manner.
using System.Threading; using System.Threading.Tasks; using DevExpress.DataAccess; using DevExpress.DataAccess.Sql; using DevExpress.DataAccess.ConnectionParameters; // ... // Create and configure an SQL data source. Access97ConnectionParameters connectionParameters = new Access97ConnectionParameters(".\\Data\\nwind.mdb", "", ""); DevExpress.DataAccess.Sql.SqlDataSource dataSource = new DevExpress.DataAccess.Sql.SqlDataSource(connectionParameters); // Create the "queryInvoices" query that serves as a data member. CustomSqlQuery queryInvoices = new CustomSqlQuery(); queryInvoices.Name = "queryInvoices"; queryInvoices.Sql = "SELECT OrderID, OrderDate, ShipName, sum(ExtendedPrice) as Total FROM Invoices GROUP BY OrderID,OrderDate,ShipName"; dataSource.Queries.Add(queryInvoices); report.DataSource = dataSource; report.DataMember = "queryInvoices"; // Populate the data source. await dataSource.FillAsync(); report.DataSource = dataSource;