All docs
V20.2
21.1 (EAP/Beta)
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.ExecuteQueryWithMetadata(String, QueryParameterCollection) Method

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.2.dll

Declaration

public SelectedData ExecuteQueryWithMetadata(
    string sql,
    QueryParameterCollection parameters
)

Parameters

Name Type Description
sql String

Specifies an SQL statement.

parameters QueryParameterCollection

Specifies query parameter values.

Returns

Type Description
SelectedData

A result set compatible with XPDataView.

Remarks

Use the ExecuteQueryWithMetadata 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).

The connection provider automatically generates sequential parameter names (p0, p1, p2 ...). To specify custom parameter names, use the overloaded ExecuteQueryWithMetadata(String, String[], QueryParameterCollection) method.

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

NOTE

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

See Also