2012-12-22 77 views

回答

10

我第一次尝试使用LiNQC#

var result = from y in aspnet_Users 
      where !(
         from x in tblUser 
         where x.active == "true" 
         select x.UsersID 
        ).Contains(y.UserId) 
      select y;     
      -- OR // select new { y.UserId, y.UserName}; 

SOURCE

+0

我认为它应该是'x.active' –

+0

@Sahuagin是的,谢谢。 –

+1

+1。 –

0
var query = 
    from c in aspnet_Users 
    where !(from o in tbluser where o.active=="true" 
      select o.UserId) 
      .Contains(c.UserId) 
    select c; 
+0

你的**副本与@JW答案有什么不同? –

+0

我没有观察@jw的答案,发布我的答案后,我才知道两者都是一样的。 – LNRao

+0

'where!aspnet_Users.Any(p => p.active ==“true”)'看起来不一样。我在这里错过了什么吗? –