Thursday, September 16, 2010

LINQ to SQL implementation step by step

LINQ to SQL implementation step by step

Right click on project solution => Add New Item =>
Select DBML class, give some appropriate name and add in project.

now open your server explorer and add some database. => drag some table on the dbml file.

// this is the class generated by hr.dbml
HRDataContext hr = new HRDataContext();

// get any one table
var q = from a in hr.GetTable()
select a;

// bind the table in datagrid
GridView1.DataSource = q;

No comments:

ETG Consultancy

Web Designing Development Analysis & Promotion
Asp.Net 2.0 SQL WWF WCF SEO Marketing Ajax JQuery NHibernate MVC