If Not linq ,Use for each row in data table and provide an if condition inside
if:CurrentRow(“Employee Status”).Equals(“Active”)
then: use Assign activity:CurrentRow(“Employee Status”)=“InActive”
Out_Dt.AsEnumerable().ToList().ForEach(Sub(row)
If row(“Employee Status”).ToString() = “Active” Then
row(“Employee Status”) = “Inactive”
End If
End Sub)
Hope this helps…
Hey Shyam, can I know the number of columns in your datatable?
The solution would be helpful if you have few numbers of datacolumns.
(
From row In dt1.Copy.AsEnumerable()
Let country = If (row(“Country”).ToString = “USA” , row(“Country”).ToString.Replace(“USA”,“US”) , row(“Country”).ToString)
Select dt1.Rows.Add(row(“City”).ToString , country)
).CopyToDataTable
My datatable had 2 columns, City and Country. In the country column, replacement is done.If you have more columns, just add those in the select line.
(From row In Out_Dt.AsEnumerable()
Let colInd = Out_Dt.Columns(“Employment Status”).Ordinal
Let col = If (row(“Employment Status”).ToString = “Active” , row(“Employment Status”).ToString.Replace(“Active”,“InActive”) , row(“Employment Status”).ToString)
Let ra = row.ItemArray.Take(colInd).Append(col).Concat(row.ItemArray.Skip(colInd+1)).ToArray()
Select Dt_Clone.Rows.Add(ra)).CopyToDataTable()