How to do SQL Like % in Linq?

前端 未结 14 1492
误落风尘
误落风尘 2020-11-22 13:46

I have a procedure in SQL that I am trying to turn into Linq:

SELECT O.Id, O.Name as Organization
FROM Organizations O
JOIN OrganizationsHierarchy OH ON O.Id         


        
相关标签:
14条回答
  • 2020-11-22 14:41

    Well indexOf works for me too

    var result = from c in SampleList
    where c.LongName.IndexOf(SearchQuery) >= 0
    select c;
    
    0 讨论(0)
  • 2020-11-22 14:41

    In case you are not matching numeric strings, always good to have common case:

    .Where(oh => oh.Hierarchy.ToUpper().Contains(mySearchString.ToUpper()))
    
    0 讨论(0)
提交回复
热议问题