Execute Non Query
AutomatR.MySQLDataBase.Database.ExecuteNonQuery
The "Execute Non Query" activity in AutomatR is designed for executing SQL commands that do not return any data, such as INSERT, UPDATE, DELETE, etc., on a MySQL database. This activity facilitates database manipulation within automation workflows.
Properties
Name | Description |
---|---|
Input | |
Command Text | Provide the SQL query in string format that needs to be executed. String variables containing the SQL query. |
Connection | Provide a MySqlConnection variable used to establish a connection to the MySQL database. Variables of type MySqlConnection. |
Misc | |
Display Name | Provides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variables containing the desired display name. |
Optional | |
Command Timeout | Provide the amount of time (in milliseconds) to wait for the SQL command to run before throwing an error. Integer variables containing the timeout duration. If not specified, a default timeout of 60 seconds is applied. |
Delay | Specifies the amount of time (in seconds) to wait before executing the "Execute Non Query" activity. This can be useful for handling synchronization issues. Integer variables containing the delay duration. Ex.: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1. |
Output | |
Result | The result of the SQL command will be stored in a Nullable<Int32> variable, allowing you to utilize it in subsequent activities or operations. Variables of type Nullable<Int32> to store the execution result. |
How to use:
- Drag and drop the "Execute Non Query" activity onto the workflow.
- Configure the properties by specifying the MySqlConnection variable, SQL query, and optionally setting the command timeout.
- Optionally, configure the delay for synchronization purposes.
- Execute the workflow to run the specified SQL command on the MySQL database.
Example: Consider an example where the "Execute Non Query" activity is used to insert data into a MySQL database:
Execute Non Query:
Connection: MySqlConnectionVariable
Command Text: "INSERT INTO Employees (FirstName, LastName) VALUES ('John', 'Doe')"
Command Timeout: 5000
Result: InsertResult
In this example, the activity executes a SQL INSERT command to add a new employee with the name "John Doe" into the "Employees" table. The result of the execution is stored in the Nullable<Int32> variable "InsertResult" for further handling in the workflow.