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”)



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

1 Like

Hello Rishabh, did you get any answer ? I have a string Val = ''ABCDEF" I have a datatable dt1 such as coulm1, column2,
abc, 1
def, 2
I want to extract based on a row based on the string. for each I can try but i want to know if there is any query I can pass.