So far, we've modeled a data context from a view, and
written two lines of code. Can it really be this easy? Let's add a couple
additional lines of code to see. We'll loop through our entire collection, and
print the name of the product to the console window. The ReadLine method will
wait until we press a key to execute, so this will hold the window open long
enough for us to see if anything printed out.
Listing 4
Sub Main()
Dim _db As New ProductsDataContext
Dim _products = From p In _db.vProductModelCatalogDescriptions Select p
For Each _p In _products
Console.WriteLine(_p.Name)
Next
Console.ReadLine()
End Sub
Press F5 to start the project, and a console window should
open up with the product names printed out. Press any key to close the
window. It really was that simple to query the data we need.