How to Update a column with 2 conditions using LINQ

I have a datatable table - dt

|User ID |Name |Type|

| 2 |fasil| | |
| 3 |Anandu | |

I need to update type as ‘ODD’ when Name= fasil and User ID = 2
Could anyone please provide a linq query to update so?

1 Like

Hi

Have a view on this video

Cheers @muhamed.fasil

1 Like

Hi,

Hope the following helps you.

image

dtResult = dt.AsEnumerable.Select(Function(r) dt.Clone.LoadDataRow({r(0),r(1),if(r(0).ToString="2" AndAlso r(1).ToString="fasil","ODD","")},False)).CopyToDataTable()

Sample20220127-4.zip (2.6 KB)

regards,

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