Remove character in a column of data table using Linq

Hello, I would like to remove the dot and comma from a specific column of the data table using linq, I did it as follows, but it’s giving me an error.

NAME COLUMN: CPF_CNPJ

(From r In tabelacorreta.AsEnumerable
Select rac = r.ItemArray.Select(Function (x) x(“CPF_CNPJ”).toString.Replace(".","").Replace("-", “”).Replace("/", “”)).toArray
Select tabelacorreta.Rows.Add(rac)).CopyToDataTable()

image

2 Likes

The LINQ IS Looping over the itemarray.so WE can Not do an assoziative Access via colname.

Doing With a for each would be a better fit for this Case. Also have a Look Here

1 Like