在LINQ內如何如用in及not in呢
正常SQL語法
Select * From Customers Where City IN ('UK', 'TW')
在LINQ呢?
Dim query = From c In db.Customers Where (New String() {"UK", "TW"}).Contains(c.City) Select c
那NOT IN呢?
Dim query = From c In db.Customers Where Not (New String() {"UK", "TW"}).Contains(c.City) Select c
分享使用微軟開發工具及工作上會遇到的疑難雜症
2009-01-28
LINQ Where in and Not in
訂閱:
張貼留言 (Atom)
0 comments:
張貼留言