code_junkie

Programming pattern using typed datasets in VS 2008

Nov 12th, 2011
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. int id = ... // the primary key we want to look for
  2. using(var ctx = new MydataContext()) {
  3. SomeType record = ctx.SomeTable.Single(x => x.SomeColumn == id);
  4. //... etc
  5.  
  6. // ctx.SubmitChanges(); // to commit any updates
  7. }
  8.  
  9. var myOrders = from row in ctx.Orders
  10. where row.CustomerID = id && row.IsActive
  11. orderby row.OrderDate
  12. select row;
Add Comment
Please, Sign In to add comment