DataTable Select function cannot perform “=” operation on System.Double and System.String

Hey @crazywindy

Check this:-
IF your Column Datatype is Int, Double kinda then use below like code.

dt.Select("Convert([Col Name],‘System.Int32’) = " + Your_variable_name.ToString())

and if your Column Datatype is of String then use below code.

Datatable result = dt.Select(“Convert([Col Name],‘System.String’) = ’ " + salary.ToString()+” ’ ").CopyToDatatable()

where-

dt - your datatable Name
Col Name - Datatable Column Name

Regards…!!
Aksh

16 Likes