Session.ExecuteNonQueryAsync(String, QueryParameterCollection, CancellationToken) Method
Asynchronously executes the specified SQL statement and returns the number of rows affected.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
NuGet Package: DevExpress.Xpo
#Declaration
public Task<int> ExecuteNonQueryAsync(
string sql,
QueryParameterCollection parameters,
CancellationToken cancellationToken = default(CancellationToken)
)
#Parameters
Name | Type | Description |
---|---|---|
sql | String | Specifies an SQL statement. |
parameters | Query |
Specifies query parameter values. |
#Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellation |
Cancellation |
null | A Cancellation |
#Returns
Type | Description |
---|---|
Task<Int32> | A Task |
#Remarks
Use the ExecuteNonQueryAsync method to execute SQL statements that do not produce result sets, such as UPDATE, INSERT, and DELETE statements.
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 ExecuteNonQueryAsync(CancellationToken, String, String[], QueryParameterCollection) method.
To learn more about executing SQL statements in XPO, refer to Direct SQL Queries.
Note
The Execute