How to Filter non numeric value on datatable using linq

how can i filter this kind of value on datatable using linq?


How about the following expression?

dt = dt.AsEnumerable.Where(Function(r) System.Text.RegularExpressions.Regex.IsMatch(r("merchantorderid").ToString,"^\d+$")).CopyToDataTable()


Hi @joscares ,

Alternately, maybe using IsNumeric to check whether the value in cell contains a non-numeric or not :

dt = dt.AsEnumerable.Where(Function(r) r("merchantorderid").ToString.Trim.IsNumeric).CopyToDataTable()

Also, to handle the Conversion to Datatable Error, check the following post :

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