How to prepend a single quote in particular column using Linq query.
Assume dt is a datatable.
and Columnname=“Id”
you dont need a linq as well…comprehension should do
dt.Columns("ID").Expression = "' + [ID]"
if you need linq only then
invoke code with passing dt as in/out
dt.AsEnumerable.ToList.ForEach(sub(x) x("ID") = "'" + x("ID").ToString)
cheers
is close to updating a column value. Find here an overview on the different approaches
How to Update Data Column Values of a Data Table | Community Blog
using the expression appproach is very powefull and also direct. However, when using the Expression within a self assignment (does mean, manipulate the own column within the setting result) then check at least very carefully for side effects
Thanks a lot @Anil_G! It is working fine
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.