Ok. Let's try Linq with database now. Database I use was SQL Express 2005.
Let's begin the lessons:
First, create new project, choose windows application.
Second, choose data connection and data source of database we want to use.
Third, add new item and choose Linq to SQL Classes. The file will create and drag the tables or stored procedure in it.
Fourth, done. Hahaha.
And now, let's use Linq in database case. Here we can see how easy we can manipulate the code and the efficiency of writing code in vb 9.
Dim presen = From absensi In db.Presensi(2008, 4) Select absensi
For
Each Presensi In presen
Debug.Print(Presensi.nama_karyawan, Presensi.Uang_Makan)
Next
Those codes above will connect to presensi where the presensi was stored procedure in my database. Below is an example of dbml (LINQ TO SQL CLASSES). Hope you enjoy it.

0 comments:
Post a Comment