Posted By

qrist0ph on 08/13/08


Tagged

Linq studentWest


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Linq in C#


 / Published in: C#
 

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. DataClasses1DataContext dc = new DataClasses1DataContext();
  13. var benutzerListe = from ds in dc.Benutzers where ds.PLY=="33" select ds;
  14. foreach (var item in benutzerListe)
  15. {
  16. Console.WriteLine(item.Vorname + " " + item.Nachname);
  17. item.Vorname = "Rolf";
  18.  
  19. }
  20.  
  21. Benutzer bn = new Benutzer() { ID = "3", Nachname = "sdfs", PLY = "saf", Strasse = "dsf", Vorname = "dsfs", Wohnort = "dsf" };
  22.  
  23.  
  24. dc.Benutzers.InsertOnSubmit(bn);
  25. dc.SubmitChanges();
  26. Console.ReadKey();
  27. }
  28. }
  29. }

Report this snippet  

You need to login to post a comment.