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. General Programming
  3. LINQ
  4. How to Fill Directly a DataTable using LINQ

How to Fill Directly a DataTable using LINQ

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqhelptutorial
3 Posts 3 Posters 2 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.
  • V Offline
    V Offline
    VenkataRamana Gali
    wrote on last edited by
    #1

    Hi all, i created database.dbml file along with table1, table2. now i wanted to fill result set of table1 into a DataTable (ex: select * from table1 where table1Id=100) please help me

    Ramana

    J P 2 Replies Last reply
    0
    • V VenkataRamana Gali

      Hi all, i created database.dbml file along with table1, table2. now i wanted to fill result set of table1 into a DataTable (ex: select * from table1 where table1Id=100) please help me

      Ramana

      J Offline
      J Offline
      Julianne_juju
      wrote on last edited by
      #2

      var result = (from myData in databaseDataContext.table1 where myData.table1Id = 100 select myData) Then you can convert result into your datatable. Here's an example how you can convert it: http://www.c-sharpcorner.com/UploadFile/VIMAL.LAKHERA/LINQResultsetToDatatable06242008042629AM/LINQResultsetToDatatable.aspx[^]

      1 Reply Last reply
      0
      • V VenkataRamana Gali

        Hi all, i created database.dbml file along with table1, table2. now i wanted to fill result set of table1 into a DataTable (ex: select * from table1 where table1Id=100) please help me

        Ramana

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        I blogged about a DataSet/DataTable extension for Linq here[^].

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        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