I'm having a problem with coding a LINQ to SQL query. In TSQL, I would use the following:
SELECT BarrierTypeKey, Description
FROM dbo.BarrierTypes WHERE BarrierTypeKey NOT IN (
SELECT DISTINCT BarrierTypeKey FROM Barriers WHERE WorksheetKey = @WorksheetKey
)
ORDER BY Description
For this I have the following LINQ statement
Dim query = From t In dc.BarrierTypes Where Not (From b In dc.Barriers Where b.WorksheetKey = worksheetKey Select b.BarrierTypeKey).Contains(t.BarrierTypeKey) Select t Order By Description
When it runs, I get the message:
Method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' has no supported translation to SQL.
Not sure where to go next.