Skip to main content

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

NameDescription
Input
Command TextProvide the SQL query in string format that needs to be executed. String variables containing the SQL query.
ConnectionProvide a MySqlConnection variable used to establish a connection to the MySQL database. Variables of type MySqlConnection.
Misc
Display NameProvides 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 TimeoutProvide 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.
DelaySpecifies 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
ResultThe 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:

  1. Drag and drop the "Execute Non Query" activity onto the workflow.
  2. Configure the properties by specifying the MySqlConnection variable, SQL query, and optionally setting the command timeout.
  3. Optionally, configure the delay for synchronization purposes.
  4. 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.