How to assign value in a Datatable row column using C#

is it possible to add a value to a specific column in a datable while Iterating to each row if the condition is True?

Datablename —> testDatable
column index is 34 where I need to add the value if condition is True
row index is assign to integer introw = 1 ----> it adds 1 to intRow as it iterates to the next row if condition is False

I understand in this is how it was done . how to Translate this syntax is C#?
—> dtExample.Rows(rowindex)(“yourcolumnname”) = "yourvalue

I tried below but doesn’t work.
Assign variable
To: testDatable.rows[introw][34]
Value: “Uipath”

Try these:

testDatable.Rows[0][“COLUMN_NAME_IN_INDEX_34”]= yourValue



testDatable.Rows[0][34]= yourValue


kindly note: C# is case sensitive and has also in some parts other syntax e.g. [ ] instead of ()

in general Marian already gave you the syntax. Also try to get help by autocomplete (intelisense) which can be also recalled within the code fields by CTRL + SPACE

1 Like

Hi @Vic_Saisan,

In addition, I am sharing a link that was opened earlier. You can follow the other examples and details in it.


1 Like

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