Execute SQL Query

Hi,

I’m having a database problem which is what I’m trying to do is I want to count total number of data in a table in database.

SQL query: select count (row_id) from Temp_Table

When I execute this query from Client DB, I can get the result but when I try to execute the same SQL using Uipath.Database activities i.e. Execute Non Query/Execute Query. I will received an error.

Error: UiPath.Database.Activities: Unable to execute from database reporting summary…System.NullReferenceException: Object reference not set to an instance of an object.

Result from Client DB:
image

What might cause this problem?

Hi,

Use Execute Query Activity. Make sure to fill the following fields with correct value:

  1. ConnectionString = Your connection string
  2. CommandType = Text
  3. SQL = “select count (row_id) from Temp_Table”
  4. DataTable = your datatable variable for the output