# EXECSQL

## Overview

The **EXECSQL** workflow application allows you to execute one or multiple SQL queries in a process.&#x20;

EXECSQL lets you retrieve information via `SELECT` queries, for example, in order to use the results in process conditions.

## How it works

* EXECSQL requires the `CONNECTION_NAME` parameter, which corresponds to the connection name, and the `QUERY` parameter, which corresponds to the query to execute.<br>
* You can specify one or multiple commands per EXECSQL action. For this, the parameters must be prefixed by `CMDx_`, where `x` corresponds to the command number (e.g. `CMD1_`).<br>
* The supported query types are `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `SCALAR`, and `PROCEDURE`.<br>
* The application supports SQL transaction management.<br>
* You can use a global connection for multiple commands. In this case, you must not prefix the `CONNECTION_NAME` parameter with `CMDx_`. It is not possible to use a global connection and a local connection (e.g. `CONNECTION_NAME` and `CMD2_CONNECTION_NAME`).<br>
* You can use a global transaction for multiple commands. In this case, you must not prefix the `TRANSACTION` parameter with `CMDx_`. It is not possible to use a global transaction and a local transaction (e.g. `TRANSACTION` and `CMD2_TRANSACTION`). It's necessary to define a global connection to be able to define a global transaction.<br>
* Application logs are available. These can be specified by setting the value of the `ExecSqlLogLevel` parameter in the `web.config` file to `0` to deactivate logs, `1` for error logs, `2` for information logs, or `3` for debug logs; the default value is `0`.

## Required parameters

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>Name of the connection to use</p><p></p><p>The connection name must be defined in the WorkflowGen <code>web.config</code> file.</p></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">Query to execute</td></tr></tbody></table>

## Optional parameters

### General

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>Type of query to execute</p><p></p><p>The supported types are:</p><ul><li><code>SELECT</code> (default)</li><li><code>INSERT</code></li><li><code>UPDATE</code></li><li><code>DELETE</code></li><li><code>SCALAR</code></li><li><code>PROCEDURE</code></li></ul></td></tr><tr><td valign="top"><code>TRANSACTION</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">When set to <code>Y</code>, the application triggers a SQL transaction before the request execution and will perform a commit or rollback based on the result.<br><strong>Default:</strong> <code>N</code></td></tr><tr><td valign="top"><code>ON_ERROR</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">When set to <code>CATCH</code>, the application will not return errors to WorkflowGen. This allows an error message to be stored in the <code>ERROR_MESSAGE</code> parameter and to continue the execution.<br><strong>Default:</strong> <code>THROW</code></td></tr><tr><td valign="top"><code>TIMEOUT</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Indicates the number of seconds to define in the command execution time<br><strong>Default:</strong> <code>30</code></td></tr><tr><td valign="top"><code>FORM_DATA</code></td><td valign="top">FILE</td><td valign="top">INOUT</td><td valign="top"><code>FORM_DATA</code> file containing the XML process definition</td></tr><tr><td valign="top"><code>FORM_DATA_GRIDVIEW</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">Identifier of the GridView to feed to the <code>FORM_DATA</code></td></tr><tr><td valign="top"><code>RESULT_CSV_SEPARATOR</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>Separator used in the return value or CSV file</p><p><strong>Default:</strong> <code>,</code> (comma)</p></td></tr></tbody></table>

{% hint style="info" %}

* If you want to populate a GridView using the `FORM_DATA_GRIDVIEW` parameter, the contents of `FORM_DATA` must contain at least the XML schema.
* If the first action of the process is an EXECSQL action, you must put a default value in `FORM_DATA` , with the definition of the schema.
  {% endhint %}

### Query parameters

For each query, you can define parameters to use during execution. These parameters can be defined in two ways: either by using the `QUERY_PARAM` prefix or by using an at sign (`@`).

#### 📌 Example

You can use `QUERY_PARAM_MyParam` or `@MyParam`, where `MyParam` corresponds to the name of the parameter defined in the query.

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SELECT * FROM USERS WHERE LASTNAME = @UserLastname</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_UserLastName</code>  / <code>@UserLastName</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Doe</code></td></tr></tbody></table>

### Return parameters

#### General

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>ERROR_MESSAGE</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Contains the error message in the event that the parameter value contains <code>CATCH</code> and an exception is thrown during execution</td></tr><tr><td valign="top"><code>RESULT_COMMIT</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Indicates whether a <code>commit</code> was performed on the transaction<br><strong>Possible values:</strong><code>Y</code> or <code>N</code></td></tr></tbody></table>

#### `SELECT` query

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>RESULT_ROWx_fieldName</code></td><td valign="top"><p>TEXT</p><p>NUMERIC</p><p>DATETIME</p></td><td valign="top">OUT</td><td valign="top"><p>Contains the value of the <code>fieldName</code> column for row <code>x</code><br></p><p>You must replace <code>fieldname</code> with your column name (e.g. <code>LASTNAME</code>) and <code>x</code> with the row number (e.g. <code>2</code>).</p></td></tr><tr><td valign="top"><code>RESULT_ROW_fieldName</code></td><td valign="top"><p>TEXT</p><p>NUMERIC</p><p>DATETIME</p></td><td valign="top">OUT</td><td valign="top">Contains the value of the <code>fieldName</code> column for the first row returned</td></tr><tr><td valign="top"><code>RESULT_JSON</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Contains the query result in <code>JSON</code> format</td></tr><tr><td valign="top"><code>RESULT_JSON_FILE</code></td><td valign="top">FILE</td><td valign="top">OUT</td><td valign="top">Contains the query result in <code>JSON</code> format stored in a <code>.json</code> file</td></tr><tr><td valign="top"><code>RESULT_XML</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Contains the query result in <code>XML</code> format</td></tr><tr><td valign="top"><code>RESULT_XML_FILE</code></td><td valign="top">FILE</td><td valign="top">OUT</td><td valign="top">Contains the query result in <code>XML</code> format stored in an <code>.xml</code> file</td></tr><tr><td valign="top"><code>RESULT_CSV</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><p>Contains the query result in <code>CSV</code> format</p><p></p><p>Data are separated according to the separator defined in the <code>RESULT_CSV_SEPARATOR</code> parameter.</p></td></tr><tr><td valign="top"><code>RESULT_CSV_FILE</code></td><td valign="top">FILE</td><td valign="top">OUT</td><td valign="top"><p>Contains the query result in <code>CSV</code> format stored in a <code>.csv</code> file</p><p></p><p>Data are separated according to the separator defined in the <code>RESULT_CSV_SEPARATOR</code> parameter.</p></td></tr></tbody></table>

#### `SCALAR` query

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Description</strong></td></tr><tr><td valign="top"><code>RESULT</code></td><td valign="top">NUMERIC</td><td valign="top">OUT</td><td valign="top">Contains the numeric result of a <code>SCALAR</code> type query</td></tr></tbody></table>

## Examples

### `SELECT` query

#### Store the results in data

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SELECT LASTNAME, FIRSTNAME, USERNAME FROM USERS</code></td></tr><tr><td valign="top"><code>RESULT_JSON</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>{ "TABLE":[ { "LASTNAME":"Administrator", "FIRSTNAME":"WorkflowGen", "USERNAME":"wfgen_admin" }, { "LASTNAME":"Doe", "FIRSTNAME":"John", "USERNAME":"john.doe" } ] }</code></td></tr><tr><td valign="top"><code>RESULT_JSON_FILE</code></td><td valign="top">FILE</td><td valign="top">OUT</td><td valign="top"><code>result.json</code></td></tr><tr><td valign="top"><code>RESULT_CSV</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><p><code>"LASTNAME","FIRSTNAME","USERNAME" "Administrator","WorkflowGen","wfgen_admin"</code></p><p><code>"Doe","John","john.doe"</code></p></td></tr><tr><td valign="top"><code>RESULT_CSV_FILE</code></td><td valign="top">FILE</td><td valign="top">OUT</td><td valign="top"><code>result.csv</code></td></tr><tr><td valign="top"><code>RESULT_ROW_LASTNAME</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>Administrator</code></td></tr><tr><td valign="top"><code>RESULT_ROW1_FIRSTNAME</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>WorkflowGen</code></td></tr><tr><td valign="top"><code>RESULT_ROW2_USERNAME</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>john.doe</code></td></tr></tbody></table>

#### Populate a GridView

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SELECT LASTNAME as REQUEST_GRID_LASTNAME, FIRSTNAME as REQUEST_GRID_FIRSTNAME, USERNAME as REQUEST_GRID_USERNAME FROM USERS</code></td></tr><tr><td valign="top"><code>FORM_DATA</code></td><td valign="top">FILE</td><td valign="top">INOUT</td><td valign="top"><code>FORM_DATA</code></td></tr><tr><td valign="top"><code>FORM_DATA_GRIDVIEW</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>REQUEST_GRID</code></td></tr></tbody></table>

{% hint style="info" %}
If EXECSQL is the first action of the process, you must define a default value for the `FORM_DATA` data containing the schema of the array, as shown in the example below:

```markup
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
            <xs:complexType>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element name="Table1">
                        <xs:complexType>
                            <xs:sequence>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="REQUEST_GRID">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:element name="REQUEST_GRID_LASTNAME" type="xs:string" minOccurs="0"/>
                                <xs:element name="REQUEST_GRID_FIRSTNAME" type="xs:string" minOccurs="0"/>
                                <xs:element name="REQUEST_GRID_USERNAME" type="xs:string" minOccurs="0"/>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                </xs:choice>
            </xs:complexType>
        </xs:element>
    </xs:schema>
    <Table1></Table1>
</NewDataSet>
```

{% endhint %}

### `INSERT` query

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT INTO WFCATEGORY (ID_CATEGORY,NAME,DESCRIPTION) VALUES (@IdCategory, @Name, @Description)</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_IdCategory</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_Name</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>CategoryName</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_Description</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Description of the category</code></td></tr></tbody></table>

Here's another possibility for query parameters:

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT INTO WFCATEGORY (ID_CATEGORY,NAME,DESCRIPTION) VALUES (@IdCategory, @Name, @Description)</code></td></tr><tr><td valign="top"><code>@IdCategory</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr><tr><td valign="top"><code>@Name</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>CategoryName</code></td></tr><tr><td valign="top"><code>@Description</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Description of the category</code></td></tr></tbody></table>

### &#x20;`UPDATE` query

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>UPDATE</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>UPDATE WFCATEGORY SET NAME = @Name WHERE ID_CATEGORY = @IdCategory</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_IdCategory</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_Name</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>NewCategoryName</code></td></tr></tbody></table>

### `DELETE` query

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>DELETE</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>DELETE FROM WFCATEGORY WHERE ID_CATEGORY = @IdCategory</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_IdCategory</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr></tbody></table>

### Stored procedure

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>PROCEDURE</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT_CATEGORY</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_ID_CATEGORY</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>CategoryName</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_DESCRIPTION</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Description of the category</code></td></tr></tbody></table>

{% hint style="info" %}
The `PROCEDURE` query type does not return a value. If you want to return a value, you must use the `SELECT` type.
{% endhint %}

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SELECT</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>EXEC GET_USER @USERNAME = @User</code></td></tr><tr><td valign="top"><code>QUERY_PARAM_User</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>wfgen_admin</code></td></tr></tbody></table>

### `SCALAR` query

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SCALAR</code></td></tr><tr><td valign="top"><code>QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SELECT COUNT(*) FROM USERS</code></td></tr><tr><td valign="top"><code>RESULT</code></td><td valign="top">NUMERIC</td><td valign="top">OUT</td><td valign="top"><code>2</code></td></tr></tbody></table>

### Launch multiple requests

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>CMD1_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT</code></td></tr><tr><td valign="top"><code>CMD1_QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT INTO WFCATEGORY (ID_CATEGORY,NAME,DESCRIPTION) VALUES (@IdCategory, @Name, @Description)</code></td></tr><tr><td valign="top"><code>CMD1_QUERY_PARAM_IdCategory</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr><tr><td valign="top"><code>CMD1_QUERY_PARAM_Name</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>CategoryName</code></td></tr><tr><td valign="top"><code>CMD1_QUERY_PARAM_Description</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Description of the category</code></td></tr><tr><td valign="top"><code>CMD2_QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>SELECT NAME FROM WFCATEGORY WHERE ID_CATEGORY = @IdCategory</code></td></tr><tr><td valign="top"><code>CMD2_@IdCategory</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top"><code>1</code></td></tr><tr><td valign="top"><code>CMD2_RESULT_ROW_NAME</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>CategoryName</code></td></tr></tbody></table>

### Requests with transactions and error management

<table data-header-hidden><thead><tr><th valign="top">Parameter</th><th valign="top">Type</th><th valign="top">Direction</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><strong>Parameter</strong></td><td valign="top"><strong>Type</strong></td><td valign="top"><strong>Direction</strong></td><td valign="top"><strong>Value</strong></td></tr><tr><td valign="top"><code>CONNECTION_NAME</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>MainDbSource</code></td></tr><tr><td valign="top"><code>CMD1_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT</code></td></tr><tr><td valign="top"><code>CMD1_QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT INTO WFCATEGORY (ID_CATEGORY,NAME,DESCRIPTION) VALUES (1, "Name", "Description")</code></td></tr><tr><td valign="top"><code>CMD1_TRANSACTION</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Y</code></td></tr><tr><td valign="top"><code>CMD1_ON_ERROR</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>CATCH</code></td></tr><tr><td valign="top"><code>CMD1_COMMIT</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>Y</code></td></tr><tr><td valign="top"><code>CMD1_ERROR_MESSAGE</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>NULL</code></td></tr><tr><td valign="top"><code>CMD2_TYPE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT</code></td></tr><tr><td valign="top"><code>CMD2_QUERY</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>INSERT INTO WFCATEGORY (ID_CATEGORY,NAME,DESCRIPTION) VALUES (1, "OtherName", "Other description")</code></td></tr><tr><td valign="top"><code>CMD2_TRANSACTION</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>Y</code></td></tr><tr><td valign="top"><code>CMD2_ON_ERROR</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><code>CATCH</code></td></tr><tr><td valign="top"><code>CMD2_COMMIT</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>N</code></td></tr><tr><td valign="top"><code>CMD2_ERROR_MESSAGE</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top"><code>Cannot insert duplicate key in object 'dbo.WFCATEGORY'. The duplicate key value is (1).</code></td></tr></tbody></table>
