Skip to main content

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

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 300 seconds is applied.
DelaySpecifies 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
ResultThe 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:

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