About this workflow
In this example we will connect to a SQL database, then we will execute a query to extract some data and finally go through the datatable and write the extracted data into the Output panel.
All database activities are stored in the UIPath.Database.Activities package.
Process automation
A. First connect to the database using the Connect activity. This activity requests a connection string used to establish a database connection and a ProviderName. The string must contain a data source, a user name and a password. A .NET Framework data provider is also used to connect to a database, execute commands and retrieve results.
A list of Data Providers can be found at:
https://msdn.microsoft.com/en-us/library/a6cd7c08(v=vs.100).aspx
The Connect activity outputs a DatabaseConnection variable which you can use throughout further acivities.
B. When using an Execute query activity, you have to keep in mind three important properties:
1. ExistingDbConnection: use the output from Connect activity.
2. SQL: Write the Sql query between inverted commas as a string.
3. Right click on DataTable field , Create Variable and give a name to your datatable.
C. Use a For each row activity to go through the datatable .