开发者

LINQ to SQL - How to "Where ... in ..."

I want to use linq to sort a resultset. The resultset should contain all items which has it's code also in the given array. To make this a bit clearer, in sql this should be:

select * from tblCodes where CodeSort in (0, 2, 3, 5, 6)

Now I开发者_StackOverflow want to do the same thing in LINQ but I can't seem to pull it off.. I've tried Contains, but that didn't give me the correct result (or I might have been using it wrong). I'm writing my code in VB.

Thanks for your help :)


Check this

Dim ids = {1, 2, 3}

Dim query = From item In context.items Where ids.Contains(item.id)item

Linq to SQL in and not in

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜