.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.ExecuteQueryWithMetadataAsync(String, CancellationToken) Method

Asynchronously executes the specified SQL query and returns its result set along with the types and names of retrieved columns.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.1.dll


public Task<SelectedData> ExecuteQueryWithMetadataAsync(
    string sql,
    CancellationToken cancellationToken = default(CancellationToken)
Public Function ExecuteQueryWithMetadataAsync(
    sql As String,
    cancellationToken As CancellationToken = Nothing
) As Task(Of SelectedData)


Name Type Description
sql String

Specifies an SQL statement.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken


A CancellationToken object that delivers a cancellation notice to the running operation.


Type Description

A Task<TResult> that returns a result set compatible with XPDataView.


Use the ExecuteQueryWithMetadataAsync 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.

To learn more about executing SQL statements in XPO, refer to Direct SQL Queries.


The ExecuteQueryWithMetadataAsync method sends statements directly, so the correct statement syntax and parameter names format depends on a particular database server.

See Also