I have a List<string
> of variable count, and I want to query (via LINQ) a table to find any items that contain any of those strings in the Text column.
Tried this (doesn't work):
items = from dbt in database.Items
where (stringList.FindAll(s => dbt.Text.Contains(s)).Count > 0)
select dbt;
Query would be something like:
select * from items where text like '%string1%' or text like '%string2%'
Is this possible?
kind of new to the whole LINQ to SQL game, but does this syntax help?
string[] items = new string[] { "a", "b", "c", "d" };
var items = from i in db.Items
where items.Contains(p.text)
select i;
Got it from:
http://blog.wekeroad.com/2008/02/27/creating-in-queries-with-linq-to-sql/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With