Using Select Method to filter Strings which have Certain Words


I am trying to use Select to filter rows with Strings that are close to e.g " Amercia Airlines"
So my logic expression is as follows:

DepartDTB.Select("[Carrier Name]=" + “’” + CarrierName1 + “’”+" OR [Carrier Name]=" + “’” + CarrierName2 + “’” )

where CarrierName1 variable is defined to be equal to " Amercia Airlines %"

But I don’t get the correct filter results…i.e not all Strings with Amercia Airlines in that column are filtered. Why is that?

How can i do it correctly?


Hi @Lim_Yen_Ling,

If CarrierName1 is equal to [Carrier Name]
DepartDTB=DepartDTB.Select("[Carrier Name]='"+CarrierName1.ToString()+"' OR [Carrier Name]='"+CarrierName2.ToString()+"' ").CopyToDataTable()

If CarrierName1 is like to [Carrier Name]
DepartDTB=DepartDTB.Select("[Carrier Name] like '"+CarrierName1.ToString()+"℅' OR [Carrier Name]='"+CarrierName2.ToString()+"' ").CopyToDataTable()


1 Like

Thanks Arivu96! It works perfectly. =)