I am trying to join a table and a list in LINQ. From posts on stackoverflow, I know that you can’t select from a table and a list using a join–that you have to use .contains. But when I use .contains I get the same error. What else am I missing? Am I trying to do something that Linq won’t support? Should I just write a supporter function that will loop through the dailyTotal records one-by-one (eliminating the need for a join)?
This is my code:
Dim count = (from sqlRec in mydatacontext.table, listItem in myList where _
sqlRec.guidIdField.ToString.contains(listItem.IdProperty.toString select sqlRec).count
It gives the same error I was trying to fix, which reads: “Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator.”
I am trying to do this (of course, the syntax below won’t work):
(from sqlRec in table, listItem in List where sqlRec.guid=listId.Id select sqlRec).count
You have to use
Containson the local sequence: