for your table try below query it will give you correct resut.
(From d In dtData.AsEnumerable
Let u = If(d(1).ToString.Trim.Equals(“-241”),“0”,d(1).ToString)
Select dtResult.Rows.Add(New Object(){d(0),u,d(2)})).CopyToDataTable
Name. || Val. || Amt. || AmtPending. || Amttaken
Shul. 56. || 765. ||-241. || -241
Gut. 787. || -241. || -241. || 567
Any way to update only AmtPending and amttaken column for val-241 to 0
(From d In dtData.AsEnumerable
Let u = If(d(3).ToString.Trim.Equals(“-241”),“0”,d(3).ToString)
Select dtResult.Rows.Add(New Object(){d(0),u,d(2)})).CopyToDataTable
for Amttaken
(From d In dtData.AsEnumerable
Let u = If(d(4).ToString.Trim.Equals(“-241”),“0”,d(4).ToString)
Select dtResult.Rows.Add(New Object(){d(0),u,d(2)})).CopyToDataTable
(From d In dtData.AsEnumerable
Let u1 = If(d(“AmtPending”).ToString.Trim.Equals(“-241”),“0”,d(“AmtPending”).ToString)
Let u2 = If(d(“Amttaken”).ToString.Trim.Equals(“-241”),“0”,d(“Amttaken”).ToString)
Select dtResult.Rows.Add(New Object(){d(“Name”),d(“Val”),d(“Amt”),u1,u2})).CopyToDataTable
refer the attached updated work flow for your reference. thanks.
For Each dtRow As DataRow In dt.Rows
For Each colName As String In {"value","AmtPending","Amttaken"}
If (dtRow(colName).ToString = "-2.41") Then dtRow(colName) = 0
Next colName
Next dtRow
Tried invoke code and getting the error screenshot which is pasted in the thread
Tried linq but here manually I have to pass all the column names
Cant use for each as I have 40k records of data
NOTE: there are around 1000 rows in each column, which has -241 value, I have to change it to 0