I have a datatable dt
There is a column named status
if value of status= “-” need to update the status column as completed
Could anyone please help me with a LINQ query. I can do the same with for loop but i need query in LINQ
I have a datatable dt
There is a column named status
if value of status= “-” need to update the status column as completed
Could anyone please help me with a LINQ query. I can do the same with for loop but i need query in LINQ
How about this expression
(From row In dt.AsEnumerable()
Let modCol = row.Field(Of String)("Status").ToString.Replace("-","completed")
Let ra = row.ItemArray.Skip(1).Prepend(modCol).ToArray()
Select Dt1.Rows.Add(ra)).CopyToDataTable()
Regards
Gokul
Hi gokul,
do i need to clone Dt to create DT1? u have mentioned a datatable variable in the last SELECT query
I am not able to use the query directly in code , getting error as the Dt1 was not declared
I have more than 1 column in my datatable, no of columns may vary w.r.t input excel
For example see the input sheet below
Bro u trying to update the first column ?, but i need to update the column named “status”
To check that can you switch the columns in build datatable and check the output
Share the Input @muhamed.fasil
For me this the Output @muhamed.fasil
if i switch the positions of input datatable columns , still the updation is happening on Column1 itself
source.xlsx (9.0 KB)
Check Out the Updated XAML file
UpdateStatus.xaml (13.2 KB)
Output
source.xlsx (9.7 KB)
Regards
Gokul