Skip to content

ExecuteQuery

Creates a connection to the relevant system using the information defined on the domain and runs the query.

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

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

A DataTable instance containing the results of the query.

Remarks

This method is used to run a query and fetch results from 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.ExecuteQuery("AppDB", "select * from Users where Id = @Id", {
    Id: "1"
});

See Also