Hello @efleurent
Mostly you get this error when you are trying to use two different datatypes in a query…
instead of all the query you have written, you can do your task only by using the Isnumeric
method
DT.AsEnumerable().Where(Function(r) cstr(r(0)).IsNumeric ).CopyToDataTable
Use the above query and let me knwo about it
Check this workflow for better understanding
Isnumeric.xaml (7.1 KB)
EDIT:- this code will work just fine unless and until it hits a blank value from an excel file…
to overcome this error
Just tweak your query a little bit by adding a .tostring instead of Cstr
DT.AsEnumerable().Where(Function(r) (r(0)).tostring.IsNumeric ).CopyToDataTable