Skip to content

ExecuteNonQuery

Creates a connection to the relevant system with the information defined on the domain and runs the query. Returns the number of affected rows.

1
$Database.ExecuteNonQuery(connectionName: string, query: string, parameters: object, timeout: number):number

Parameters

string connectionName
    The name of the external database connection.

string query
    The query to be run.

object parameters
    An object containing parameters for the query. Optional.

number timeout
    The request timeout in seconds. Optional.

Returns

The number of rows affected by the query.

Remarks

This method is used to run a query on an external database. The connection name is defined in the domain settings with a connection string to the database.
The query dialect is based on the external database type and is directly executed on the database.
The timeout parameter is used to specify the maximum time to wait for the query to execute. If not specified, the default timeout is used.

Example

1
2
3
$Database.ExecuteNonQuery("AppDB", "delete Users where Id = @Id", {
    Id: "1"
});

See Also