LINQ To SQL中IN的用法

IN:
C#
var result = from s1 in context.Customers where (new string[]
                      { "UK", "Lisboa" }).Contains(s1.City) select s1;
VB.NET
Dim lists = From s1 In context.Customers Where (New String() {"UK", "Lisboa"}).Contains(s1.City) Select s1
NOT IN:
C#
  var result = from s1 in context.Customers where !(new string[] { "UK", "Lisboa" }).Contains(s1.City) select s1;
VB.NET
      Dim lists = From s1 In context.Customers Where Not (New String() {"UK", "Lisboa"}).Contains(s1.City) Select s1      
 
 

本文出自 “WPF外包公司―北京动点..” 博客,转载请与作者联系!

你可能感兴趣的:(sql,数据库,用法,LINQ,休闲)