Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Linq Queries

Linq Queries

Scheduled Pinned Locked Moved ASP.NET
csharplinqquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hahii
    wrote on last edited by
    #1

    Actually I am very new to Linq. But I have a project where I have to use linq to entities. I have a Gridview in my aspx page and I have a table named Address with 6 columns. I have to bound this Gridview with data from table and I have to delete, update and insert new records using linq quiereies. How can I do that. I really appreciate that. Regards,

    P 1 Reply Last reply
    0
    • H hahii

      Actually I am very new to Linq. But I have a project where I have to use linq to entities. I have a Gridview in my aspx page and I have a table named Address with 6 columns. I have to bound this Gridview with data from table and I have to delete, update and insert new records using linq quiereies. How can I do that. I really appreciate that. Regards,

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      //you have to create a DataClasses1.dbml and drag and drop ur tables and proceed //these are methods and you have to pass the values. public static void insert(int id, string name, string address, string department, string gender, int phone) { // DataClasses1.dbml name DataClasses1DataContext da = new DataClasses1DataContext(); //table name linq_padhu_emp data = new linq_padhu_emp { id = id, name = name, address = address, department = department, gender = gender, phone = phone }; da.linq_padhu_emps.InsertOnSubmit(data); da.SubmitChanges(); } public static void update(int id, string name, string address, string department, string gender, int phone) { DataClasses1DataContext up = new DataClasses1DataContext(); linq_padhu_emp updating = up.linq_padhu_emps.First(P => P.id == id); updating.name = name; updating.address = address; updating.department = department; updating.gender = gender; updating.phone = phone; up.SubmitChanges(); } public static void delete(int id) { DataClasses1DataContext del = new DataClasses1DataContext(); linq_padhu_emp deleting = del.linq_padhu_emps.First(P => P.id == id); del.linq_padhu_emps.DeleteOnSubmit(deleting); del.SubmitChanges(); }

      Padmanabhan

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups