HighTechTalks DotNet Forums  

Linq to entites and contains method

Dotnet Framework microsoft.public.dotnet.framework


Discuss Linq to entites and contains method in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
RBScheer
 
Posts: n/a

Default Linq to entites and contains method - 07-16-2010 , 05:54 PM






Hi.

I am trying to simulate the IN operator in Linq to entites using a
List of integers, like below:

Dim lstFound As IList(Of Entities.Local) = Nothing

Dim ls As New List(Of Integer)
ls.Add(21)
ls.Add(38)

lstFound = (From a In context.Local Where a.Area = 1 And
ls.Contains(a.LocalCode)).ToList

When I run this code, I receive the following error:

"LINQ to Entities does not recognize the method 'Boolean
Contains(Int32)' method, and this method cannot be translated into a
store expression."

Can you help me to see what is wrong here or on how to do a correct IN
using integers?

Regards,
Robert Scheer

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.