Skip to main content
.NET 6.0+

Session.ExecuteQueryWithMetadata(String, 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.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

public SelectedData ExecuteQueryWithMetadata(
    string sql,
    string[] parameterNames,
    QueryParameterCollection parameters
)

Parameters

Name Type Description
sql String

Specifies an SQL statement.

parameterNames String[]

Specifies parameter names.

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).

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