Trim the Column data

Dear Forum Members,

I have a data table with large no of records and many columns has the space in every cell in starting and last of the cell data.

So i want the same data table but without the space.

Please help me with the linq query as data table has the many records.

Thanks in advance.

Assign Activity:
dtCorrected = dtOrigin.Clone()

Assign Acitvity:
dtCorrected =

(From r In dtOrigin.AsEnumerable
let ra = r.ItemArray.Select(Function (x) x.ToString.Trim()).toArray()
Select dtCorrected.Rows.Add(ra)).CopyToDataTable()

@ppr Thanks, It work fine.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.