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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to merge two datasets?

How to merge two datasets?

Scheduled Pinned Locked Moved C#
questiontutorial
4 Posts 4 Posters 1 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.
  • L Offline
    L Offline
    Lexa1983
    wrote on last edited by
    #1

    There is table with name TableName in first dataset Id Name Selected ---------------------- 1000 Name1 0 1001 Name2 0 1002 Name3 0 There is table with the same name in second dataset Id Name Selected ---------------------- 1000 Name1 1 How can I merge them to get this: Id Name Selected ---------------------- 1000 Name1 1 1001 Name2 0 1002 Name3 0 I prefer to do this by using Merge method, but not with foreach...

    G A I 3 Replies Last reply
    0
    • L Lexa1983

      There is table with name TableName in first dataset Id Name Selected ---------------------- 1000 Name1 0 1001 Name2 0 1002 Name3 0 There is table with the same name in second dataset Id Name Selected ---------------------- 1000 Name1 1 How can I merge them to get this: Id Name Selected ---------------------- 1000 Name1 1 1001 Name2 0 1002 Name3 0 I prefer to do this by using Merge method, but not with foreach...

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Where do you get the datasets from? If you fetch them from a database, you can easily merge them in the query. Example: select Id, Name, Selected from Table1 union select Id, Name, Selected from Table2 order by Id --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • L Lexa1983

        There is table with name TableName in first dataset Id Name Selected ---------------------- 1000 Name1 0 1001 Name2 0 1002 Name3 0 There is table with the same name in second dataset Id Name Selected ---------------------- 1000 Name1 1 How can I merge them to get this: Id Name Selected ---------------------- 1000 Name1 1 1001 Name2 0 1002 Name3 0 I prefer to do this by using Merge method, but not with foreach...

        A Offline
        A Offline
        ayuba asia
        wrote on last edited by
        #3

        u can try to use the ADO dataset merge functin [URDATASET].Merge([URANOTHER DATASET] i may work and works for me last time

        1 Reply Last reply
        0
        • L Lexa1983

          There is table with name TableName in first dataset Id Name Selected ---------------------- 1000 Name1 0 1001 Name2 0 1002 Name3 0 There is table with the same name in second dataset Id Name Selected ---------------------- 1000 Name1 1 How can I merge them to get this: Id Name Selected ---------------------- 1000 Name1 1 1001 Name2 0 1002 Name3 0 I prefer to do this by using Merge method, but not with foreach...

          I Offline
          I Offline
          Ista
          wrote on last edited by
          #4

          Merge will only merge tables into the dataset not the actual table. Calling ImportRow on the target table will do what you want. You much better off to put this action into a stored procedure get the result into a table. Your trying to do a set method in an ISAM structure. It wont work. I'm not an expert yet, but I play one at work. Yeah and here too. -- modified at 20:16 Sunday 11th December, 2005

          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