CET 4429 Lectures
Getting Started with LINQ
The intention of this lecture is to get you started with the ability to use LINQ. The class is not designed to make you an expert VB or C# programmer, but the ability to use languages to access and use data is paramount. This lecture will show how you can quickly and easily get started and do some really cool stuff, fast.
Pre-requisites:
Visual Studio 2008 - with .NET 3.5
Video
For those who plan to work with LINQ check out the Microsoft How-to Video Lectures Series for LINQ ( page link )
Download
Link
Source Code
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim db As New DataClassesDataContext
Dim qr = From dbcRow In db.DBConnections Select id = dbcRow.DBConnectionID, name = dbcRow.DBConnectionName
DropDownList1.DataSource = qr
DropDownList1.DataTextField = "name"
DropDownList1.DataValueField = "id"
DropDownList1.DataBind()
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Dim db As New DataClassesDataContext
Dim i As Long = DropDownList1.SelectedValue
gridview1.DataSource = db.spGetDBConnection(i).ToList
gridview1.DataBind()
End Sub
End Class
Comments (0)
You don't have permission to comment on this page.