Not getting an output from "run query" activity

Hello everyone

I am currently trying to go into a database, retrive some tables and print them out on the console (log message). I am using a “Connect to database” and saving the output to a variable “conn” which is of type DatabaseConnection aftwerward I am using a “Run query” activity and giving it the “conn” as input and saving as output a variable “sql_output” which is of type DataTable. Using a “Log Message” I can’t seem to print out anything. It just prints blank even though I have tables and values in my table and my SQL query is correct.

@nmjvk

Use the output data table and pass the sql query avriable into that and the output of output data table pass into the log message

regards

@nmjvk

Please use a break point and check the data from locals panel

also check if two variables with same name in different scope are present

also your sql has where condition? then see if it is filtering all rows

cheers

Hi @nmjvk

Do debug the code and enter the variable in the watch panel.
Then the data in that variable is shown in the watch panel.
Check for there.

Hope it helps!!

Hello sir Anil

I have just double checked via debug. My output variable “sql_output” has correctly stored the information from the table, it has headers and associated values. I do no have two variables in different scores and my SQL has no WHERE condition.

cheers

@nmjvk

If your output datatable already have info then thats a good thing

Now you can write the data to excel and check

or you can converted the datatable to string using output datatable activity and then print the string output in log messages

This should work for you

cheers

1 Like

Dear Anil

On the production machine I am working on Excel is not an option since it is not installed, however, using the

“converted the datatable to string using output datatable activity and then print the string output in log messages”

worked perfect. Thank you so much sir Anil the great.

cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.