Problems with output from database

datatable
database
datatypes

#1

The connection with the SQL database could be established using UIPath. In the SQL database, I have created a table in which the id is int. I’m unable to retrieve data in its actual form as the writeLine and message box activities expect string values. Is there any other way to display the values?

In this image, you can see that the output obtained is the path and not the required value.


#2

DataRow doesn’t have an overload for .ToString(), hence you’re getting the Type instead.
You need to either access individual column values in a row, or use ItemArray.

One example:
Inside write line: String.Join(", ", row.ItemArray)"

Regards,
Andrzej


#3

Thank you for your support @andrzej.kniola .


#4

Hi @sushree.suravibuyan,

You may also access the values from the row by using the column index or the column name. For example:

name = row.Item("Name").ToString

If the column name is the first column you may also access it like:

name = row.Item(0).ToString


#5

Thanks @acaciomelo for your support. I did it with the previous solution.


#6

The above solution retrieves a whole row of items. Could any of you please direct me as to how I can retrieve a single value from the database? @andrzej.kniola @acaciomelo