Datatable Column Containing Value Partial match with a string

Hi Guys,

I have a DataTable ‘DT’ with ‘Name’ Column along with some other Columns. I want to get those rows whose ‘Name’ Value partially matches with a string ‘temp’ in a single line using Select Query or DT.AsEnumerable.Where() Query.
Ex : If “Kane” is ‘Name’ in DataTable and temp is “MyKane” , this query should give me the row as Kane value of Column is partially matching with temp.
Using For Each Row, I am able to do it but I want to do it using Select Query or something which gives me output in a single line.

HI @rishabhj - Something like this query you are asking about.

Assign DT1 = from col in DT.Select() where col(“Name”).ToString.Contains(“Kane”)


1 Like

Hi @AnandKumar26,
This I am getting but I want to check this other way
Ex : temp.contains(col(“Name”))
where temp = MyKane and DT is having a cloumn with Name whose one of the value is Kane