Session.ExecuteQueryAsync(String, String[], QueryParameterCollection, CancellationToken) Method
Asynchronously executes the specified SQL query and returns a result set.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
Parameters
Name | Type | Description |
---|---|---|
sql | String | Specifies an SQL statement. |
parameterNames | String[] | Specifies parameter names. |
parameters | QueryParameterCollection | Specifies query parameter values. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellationToken | CancellationToken | null | A CancellationToken object that delivers a cancellation notice to the running operation. |
Returns
Type | Description |
---|---|
Task<SelectedData> | A Task<TResult> that returns a result set compatible with XPDataView. |
Remarks
Use the ExecuteQueryAsync method to query data stores for resulting sets. You can visualize resulting sets using the XPDataView. Refer to this article for additional information: How to: Access Data in SQL Query Results.
Use QueryParameterCollection to pass strongly-typed parameters. See examples here: Always Encrypted (SQL Server only).
To learn more about executing SQL statements in XPO, refer to Direct SQL Queries.
Note
The ExecuteQueryAsync method sends statements directly, so the correct statement syntax and parameter names format depends on a particular database server.