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. C#
  4. How to reject changes between two equal DataTables?

How to reject changes between two equal DataTables?

Scheduled Pinned Locked Moved C#
questiondatabasetutorial
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.
  • O Offline
    O Offline
    obarahmeh
    wrote on last edited by
    #1

    Dear All, I have two DataTables. The first (FirstDataTable) is filled by a query and the second is filled by: SecondDataTable= FirstDataTable; after this equal operation, the two DataTables are connected and any change is reflected between the both. I mean when you change the data in the FirstDataTable by a different query, this change will be reflected to the SecondDataTable automatically. The question here: How can I stop or reject the connection between the two DataTables. I mean I do not want to reflect the changes after the equal operation. this is to make a copy of the first data returned by the first run of the query. Regards.

    Kind Regards OBarahmeh

    D 1 Reply Last reply
    0
    • O obarahmeh

      Dear All, I have two DataTables. The first (FirstDataTable) is filled by a query and the second is filled by: SecondDataTable= FirstDataTable; after this equal operation, the two DataTables are connected and any change is reflected between the both. I mean when you change the data in the FirstDataTable by a different query, this change will be reflected to the SecondDataTable automatically. The question here: How can I stop or reject the connection between the two DataTables. I mean I do not want to reflect the changes after the equal operation. this is to make a copy of the first data returned by the first run of the query. Regards.

      Kind Regards OBarahmeh

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      obarahmeh wrote:

      SecondDataTable= FirstDataTable;

      This means both tables are referring to the same object in memory. What you can do is, create a deep copy of the FirstDataTable. You can find a lot of examples on web for doing this.

      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

      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