LINQ To SQL Cheat Sheet

Reviews
Shared by: tamir13
Stats
views:
196
rating:
not rated
reviews:
0
posted:
11/15/2008
language:
pages:
0
C# Version 1 - May 2007 Created by Ben Hall Available free at blog.benhall.me.uk DATA CONTEXT NorthwindDataContext db = new NorthwindDataContext (“server=.;”); SELECT var qry= from p in products select p; Or select p.val; Or select new {a = p.val} INSERT ORDER BY db.Product.Add(new Product()) db.SubmitChanges(); UPDATE productObjectFromDB.Price = 123; db.SubmitChanges(); DELETE db.Product.Remove(productOb jectFromDB) db.SubmitChanges(); TAKE var qry= (from p in products select p).Take(5) SKIP MAX var qry= (from p in products select p).Skip(5) db.Products.Max(p => p.Price) SELECT SINGLE OBJECT Product p = db.Products.Single(p => p.ProductID == 123); var qry= from p in products orderby p.ProductName.Length Or orderby p.ProductName Or orderby p.UnitsInStock descending select p; JOIN from p in persons join w in workers on new { p.FirstName, p.LastName } equals new { w.FirstName, w.LastName } select p; Or WHERE var qry= from p in products WHERE p.val == 123 (Equals) Or WHERE p.val != 123 (Not Equals) Or WHERE p.val > 1 && p.val < 3 (Between) select p; Join o in orders on p.ProductID equals o.ProductID

Related docs
LINQ CHEAT SHEET
Views: 12  |  Downloads: 3
LINQ to SQL Cheat Sheet
Views: 21  |  Downloads: 5
LINQ to SQL
Views: 73  |  Downloads: 3
LINQ Standard Query Operators Cheat Sheet 2008
Views: 664  |  Downloads: 21
linq to sql beta 2 to rtm breaking changes
Views: 1  |  Downloads: 0
Linq
Views: 80  |  Downloads: 4
LINQ 2 SQL
Views: 83  |  Downloads: 0
LINQ to SQL Tutorial
Views: 2  |  Downloads: 0
DEVELOPING APPLICATIONS WITH LINQ 2 SQL
Views: 39  |  Downloads: 1
LINQ – Bringing Data into Visual Basic
Views: 0  |  Downloads: 0
premium docs
Other docs by tamir13