Session.ExecuteNonQuery(String) Method
In This Article
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
#Parameters
Name | Type | Description |
---|---|---|
sql | String | Specifies an SQL statement. |
#Returns
Type | Description |
---|---|
Int32 | The number of rows affected by the executed SQL statement. |
#Remarks
Use ExecuteNonQuery to execute SQL statements that do not produce result sets, such as UPDATE, INSERT, and DELETE statements.
The example below demonstrates how to use this method. Here, session is the Session instance.
using DevExpress.Xpo;
// ...
public void UpdateOrderDetails() {
const string queryString =
"UPDATE [Northwind].[dbo].[Order Details] SET [Discount] = 0.15";
int rowsAffected = session.ExecuteNonQuery(queryString);
}
To learn more about executing SQL statements in XPO, refer to Direct SQL Queries.
Note
The Execute
See Also