I have a datatable with 10 columns
There is a column named Price
I need to update the whole column with value as “10” using linq query
Just use For Each Row in Datatable and Assign the values.
I know that method bro. I need LINQ query for now
Try this
dt = dt.AsEnumerable.Select(Function(r) dt.Clone.LoadDataRow({r(0),r(1).ToString.Replace(“,”,“、”),r(2),r(3),r(4),r(5),r(6)},False)).CopyToDataTable()
1 Like
Hello @muhamed_fasil ,
Use the below LinQ expression :
(From R1 In TestDt.AsEnumerable
Select R = NewDt.Rows.Add(R1.ItemArray.Append(“Test”).ToArray)).CopyToDataTable()
Regards,
Rohith
DT.asenumerable.Tolist.Foreach(Sub(r) r(“Price”)=“10”).Copytodatatable
use this in Invoke Code
1 Like
How about this expression ?
dt.AsEnumerable.Where(Function(r) r("Price").ToString ="").ToList.ForEach(
Sub(r)
r("Price")=r("10").ToString
End Sub
)
Regards
Gokul
Why do you need a LINQ query?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.