Execute Reader
AutomatR.MySQLDataBase.Database.ExecuteReader
The "Execute Reader" activity in AutomatR is used to execute a query on a MySQL database and retrieve the query result as a DataTable. This activity is beneficial for scenarios where you need to fetch data from a database and use it in subsequent steps of your automation workflow.
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 300 seconds is applied. |
Delay | Specifies the amount of time (in seconds) to wait before executing the "Execute Reader" 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 DataTable variable, allowing you to utilize it in subsequent activities or operations. Variables of type DataTable to store the query result. |
How to use:
- Drag and drop the "Execute Reader" activity onto the workflow.
- Configure the properties by specifying the MySqlConnection variable and the SQL query.
- Optionally, configure the command timeout and delay for synchronization purposes.
- Execute the workflow to run the specified SQL query on the MySQL database and retrieve the result as a DataTable.
Example: Consider an example where the "Execute Reader" activity is used to fetch employee data from a MySQL database:
Execute Reader:
Connection: MySqlConnectionVariable
Command Text: "SELECT * FROM Employees"
Command Timeout: 5000
Result: EmployeeData
In this example, the activity executes a SQL SELECT command to retrieve all data from the "Employees" table. The result, which is a DataTable containing employee data, is stored in the DataTable variable "EmployeeData" for further handling in the workflow.