Session.ExecuteScalar(String, String[], QueryParameterCollection) Method
Executes the specified SQL query and returns the first column of the first row in the result set returned by the query.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
NuGet Package: DevExpress.Xpo
#Declaration
public object ExecuteScalar(
string sql,
string[] parameterNames,
QueryParameterCollection parameters
)
#Parameters
Name | Type | Description |
---|---|---|
sql | String | Specifies an SQL statement. |
parameter |
String[] | Specifies parameter names. |
parameters | Query |
Specifies query parameter values. |
#Returns
Type | Description |
---|---|
Object | The first column of the first row in the query’s result set. A null reference (Nothing in Visual Basic) if the result set does not contain columns. DBNull. |
#Remarks
Use the ExecuteScalar method to query data stores for a single or aggregate value, without having to retrieve a result set.
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 Execute