I want to search for a string in multiple columns using ling-to-sql and I'm wondering how to write the where
clause. This is what I have: I'm passing a list of IDs to search as well as a search term:
public List<long> Seach(string TheSearchTerm, List<long> TheIDs)
{
using (SomeDataContext TheDC = new SomeDataContext())
{
var TheOutput = (from t in TheDC.SomeTable
where TheIDs.Contains(t.ID) &&
where "TheSearchTerm is in one of the columns"
select t.ID).ToList();
}
}
How do I write the second where
clause the searches for all the columns? I thought of writing a where clause for each column but I'm wondering if there's a better way.
Thanks.