Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys

I need to use not in operator.

I have a service method which returns array of customers
and also i have a table which return list of customers
there is a reference field string same in both
i need to fetch from service only those customer
whose reference number is not in the local data base,
i am doing following not it does not work , i am using entity framework for local
data base.
C#
var qry = from e in _client.GetCustomers(APIKey)
          where entities.Customers.Any(a=> e.Reference== a.Reference)
          select e;


regards.
Posted
Updated 31-Jan-12 21:38pm
v2
Comments
Sergey Alexandrovich Kryukov 1-Feb-12 3:34am    
What do you want to use; and if not in operator, then in what? :-)
I'm just kidding... at least write "not" in quotation marks, for it's too hard to understand.
--SA

1 solution

Have a look at this article

http://introducinglinq.com/blogs/marcorusso/archive/2008/01/14/the-not-in-clause-in-linq-to-sql.aspx[^]

e.g

C#
var query =
    from e in _client.GetCustomers(APIKey)
    where !(from o in _client.GetCustomers(APIKey)
            select o.Reference)
           .Contains(e.Reference)
    select e;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900