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


Have a view on this video

Cheers @muhamed.fasil

1 Like


Hope the following helps you.


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() (2.6 KB)


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