Using contains() in LINQ to SQL

后端 未结 7 1806
野性不改
野性不改 2020-11-27 05:39

I\'m trying to implement a very basic keyword search in an application using linq-to-sql. My search terms are in an array of strings, each array item being one word, and I

7条回答
  •  天涯浪人
    2020-11-27 06:10

    I feel this is somewhat simple and working for me:

    string[] product = products.Split(','); 
    using (var context = new ProjectTrackerEntities()) 
    { var result = from part in context.DBAudits where product.Contains(part.TableName) select part; }
    

提交回复
热议问题