'______________________________________________________________ ' G E T T I N G T O K N O W L I N Q Step 2 ' C# VERSION ' Ron Kessler ' 2/5/09 ' _____________________________________________________________ ' This time lets limit the number of columns returned so the grid looks more useful. ' BE SURE TO SET THIS AS THE STARTUP PAGE IN THE SOLUTION EXPLORER 'I also sorted the results on this form. Imports System.Linq Partial Class Step2 Inherits System.Web.UI.Page Dim dc As New AdventureworksDataContext Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load '---create a LINQ query string. Dim products = From eachproduct In dc.Products _ Where (eachproduct.ProductCategoryID = 18) _ Order By eachproduct.Color _ Select eachproduct.ProductNumber, eachproduct.Name, eachproduct.Color, eachproduct.ListPrice '---now link up the grid to display our data GridView1.DataSource = products GridView1.DataBind() 'make it so! End Sub End Class