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. Database & SysAdmin
  3. Database
  4. Parent not present in GetChanges()

Parent not present in GetChanges()

Scheduled Pinned Locked Moved Database
databasedata-structuresdebugginghelptutorial
4 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.
  • G Offline
    G Offline
    goldoche
    wrote on last edited by
    #1

    Hi, I have a problem. Both simple and weird. Say I have ParentTable and ChildTable. Obviously, ChildTable is a child of ParentTable. Both are strongly-typed DataSets. When I create rows for them, I start by creating a ParentTableRow (dataset.ParentTable.AddParentTableRow()), and inserting it into my dataset. Then I create my childTable the same way, and I have to specify the a ParentTableRow, as a reference to its parent. I do it and it looks fine in the debugger (i.e. the ParentTableRow is set). I insert the child row into the dataset too. Then, before committing the changes to the database, I must call GetChanges() on ChildTable, which gives out an array of all rows that have been changed since the loading of the dataset. My new ChildTableRow appears, BUT the ParentTableRow member, (the reference to its parent) is NULL, although it was set earlier! Just before the call to GetChanges() I looked at my ChildTable in the debugger (from dataset.ChildTable) and guess what? The ParentTableRow is still there! It looks like GetChanges() ignores the reference to the ParentTableRow or something... Has anyone any idea of what's going on and how to get though this? Thank you!

    G 1 Reply Last reply
    0
    • G goldoche

      Hi, I have a problem. Both simple and weird. Say I have ParentTable and ChildTable. Obviously, ChildTable is a child of ParentTable. Both are strongly-typed DataSets. When I create rows for them, I start by creating a ParentTableRow (dataset.ParentTable.AddParentTableRow()), and inserting it into my dataset. Then I create my childTable the same way, and I have to specify the a ParentTableRow, as a reference to its parent. I do it and it looks fine in the debugger (i.e. the ParentTableRow is set). I insert the child row into the dataset too. Then, before committing the changes to the database, I must call GetChanges() on ChildTable, which gives out an array of all rows that have been changed since the loading of the dataset. My new ChildTableRow appears, BUT the ParentTableRow member, (the reference to its parent) is NULL, although it was set earlier! Just before the call to GetChanges() I looked at my ChildTable in the debugger (from dataset.ChildTable) and guess what? The ParentTableRow is still there! It looks like GetChanges() ignores the reference to the ParentTableRow or something... Has anyone any idea of what's going on and how to get though this? Thank you!

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      why don't you call GetChanges on the whole dataset itself? I think it would solve your problem.

      #region signature my articles #endregion

      G 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        why don't you call GetChanges on the whole dataset itself? I think it would solve your problem.

        #region signature my articles #endregion

        G Offline
        G Offline
        goldoche
        wrote on last edited by
        #3

        Well thanks, it solves my problem, but do you know why it is so? I sincerely feel like I'm missing a piece of the puzzle here. Thank you very much!

        G 1 Reply Last reply
        0
        • G goldoche

          Well thanks, it solves my problem, but do you know why it is so? I sincerely feel like I'm missing a piece of the puzzle here. Thank you very much!

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          No. I don't know why it is so :)

          #region signature my articles #endregion

          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