Update data table coloum with linq

Hi,

I need to update a column with “dummy” string so i followed the simple update query
But facing issue… it is not getting update with “dummy” string instead it is updated with “False”

Can you pleas guide how to update a column with any string

Below is the query

(From row in dttest
Let x = new object (){row(“Col1”,(row(“Col2”).Tostring).Equals(“dummy”)}
Select dtoutput.rows.add(x)). copytodatatable

Please guide me where I am doing wrong

Hi @Harbansh_Singh ,

Try Changing the Query to the Below :

(From row in dttest
Let x = new object (){row("Col1").ToString,row("Col2").Tostring,"dummy"}
Select dtoutput.rows.add(x)).Copytodatatable

If this doesn’t work, let us know if there is a Condition implied to Update the Column with String dummy or let us know what should be the Expected Output.

Also, If it is a Straight forward Updating all values of that particular Column to Dummy, You could delete that Column and use Add Data Column Activity to add the Deleted Column back with Default value as dummy.

Hi @Harbansh_Singh,

From that code snippet, (row(“Col2”).Tostring).Equals(“dummy”) is a condition that returns true or false. Hence it’s updating the boolean value.

You may try this:
(From row in dttest
Let x = new object (){row(“Col1”).Tostring, “dummy”)}
Select dtoutput.rows.add(x)). copytodatatable

Hope this helps.

Thanks,
Ashwini Kempraj

1 Like

@supermanPunch

Yes its worked now, instead of col2 in need to give the value which i need to update.

Thanks for your explanation

1 Like

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