Skip to main content

Execute Reader

AutomatR.MSSQLDataBase.Database.ExecuteReader

The "Execute Reader" activity in AutomatR for SQL Server databases allows you to execute a SQL SELECT query and retrieve the result set as a DataTable. This activity is useful for retrieving data from a database for further processing in your automation workflow.

Properties

NameDescription
Input
ConnectionProvide a SQL connection variable that will be used to establish a database connection.
Command TextProvide a SQL query in string format. This represents the SELECT query to be executed to retrieve data from the database.
Misc
DisplayNameProvides 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. If not specified, the default timeout is set to 60 seconds.
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
ResultOutputs the result of the SQL SELECT query as a DataTable. The DataTable variable can be used for further activities and processing in the workflow.

How to use:

  1. Drag and drop the "Execute Reader" activity onto the workflow.
  2. Configure the properties by specifying the SQL connection variable and the SQL SELECT query.
  3. Optionally, configure the command timeout and delay for synchronization purposes.
  4. Execute the workflow to execute the specified SELECT query on the database and retrieve the result set as a DataTable.

Example: Consider an example where the "Execute Reader" activity is used to retrieve employee data from a SQL Server table:

Execute Reader:
Connection: SqlConnectionVariable
Command Text: "SELECT FirstName, LastName, Age FROM Employees WHERE Department = 'IT'"
Command Timeout: 5000
Result: EmployeeData

In this example, the activity executes the SQL SELECT query to retrieve the first name, last name, and age of employees in the IT department. The result, stored in the DataTable variable "EmployeeData," can be used for further processing in the workflow.