Remove specific char's from datatable column without for each

Hi All ,

   i have a datatable where one particular column is having value as "INR 129.00", here i want to remove the INR without using For Each command...pls help me on this any possibilities using LINQ

Hi @fayaz
do one use for each row in datatable

Assign strvar=row(“Value”).ToString

StrArray=strvar.ToString.Split(“INR”.ToCharArray).

Thanks
Ashwin S

Thanks @AshwinS2 , Yes it should work in for each…i was thinking any possibilities without using it and can achieve it with LINQ…

@fayaz

Try below Linq query.

                 newDT = datatable.AsEnumerable().Where(Function(row) row("ColumnName").ToString.Replace("INR", "")) .CopyToDataTable
2 Likes

Hi @fayaz

I was about to say the same

Thanks
Ashwin S

3 Likes

@lakshman Thanks bro, i am facing compilation error as follow " [Getting the error as - option strict on disallows implicit conversions from ‘string’ to ‘boolean’] "…any idea bro?

2 Likes

@fayaz

Sorry… Its my bad. Try below one:

                   DataRow []  newValues = datatable.AsEnumerable().Select(Function(row) row("ColumnName").ToString.Replace("INR ", "")).ToArray
5 Likes

Hi,

How to remove multiple columns in datatable using linq?

@SARITHA_Masani
Can you Open for your question a new topic as IT differs from Origin older Threads topic. Thanks