Linq to SQL

Linq to SQL


Referring to http://www.revenmerchantservices.com/page/Linq-to-Sql.aspx

Filter Items into DB using Linq to SQl


Create DataBaseContext objct
AdventureWorksDataContext advDBc = new AdventureWorksDataContext();

var query = from entities in advDBc.Products   // select entities from product

where entities.Name.StartsWith("B")       // This will give all products starting with B

select entities;    // all linq statements must end with select or groupby clauses

GridView1.DataSource = query;

GridView1.DataBind();

 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5