204Microsoft Visual Studio 2010: A Beginner’s Guide
Console.ReadKey();
}
}
}
VB:
Module Module1
Sub Main()
Dim myShop As New MyShopDataContext
Dim customers =
From cust In myShop.Customers
Where cust.Name IsNot "Joe"
Select cust
For Each cust In customers
Console.WriteLine("Name: " & cust.Name)
Next
Console.ReadKey()
End Sub
End Module
And here’s the output using my data:
Name: Meg
Name: May
Other than the obvious fact that we’re now getting our data from a real database, the difference between Listing
“Could not find an implementation of the query pattern for source type ‘System. Data.Linq.Table<LinqToSqlDemoCS.Customer>’. ‘Where’ not found. Are you missing a reference to 'System.Core.dll’ or a using directive for ‘System.Linq’?”
Remember this message because any time you add a new file to a C# project where you are coding LINQ queries, this will be an indication you need to add a using directive for the System.Linq namespace.