Usage of In predicate in linq vb.net
LINQ
2
Posts
2
Posters
2
Views
1
Watching
-
There isn't an In predicate in LINQ. I assume you mean the IN clause from SQL. e.g.
SELECT * FROM Customers WHERE Country IN ('UK','Germany');
There are several ways to do this. The simplest:
Dim countries = new String() {"UK","Germany"}
Dim query = from c in db.Customers _
where countries.Contains(c.Country) _
select cNote that LINQ to SQL translates the .Contains() function into an IN clause.
'Howard