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. very strange behaviour

very strange behaviour

Scheduled Pinned Locked Moved Database
helpdatabasewpfwcf
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.
  • R Offline
    R Offline
    ricardojb
    wrote on last edited by
    #1

    I'll try to explain this. I have a Windows form with a datagrid. The datagrid binding has been set as MyDataGrid.SetDataBinding(MyDataView, "") The dataview has also a RowFilter to show only some records. Now, the problem is that I need to do some calculations whenever something is changed in that table. For that I use the RowChanged and RowDeleted events. Now, I have no problems with rows deleted, or rows that are modified, but I do with rows added. When I add a new row, the RowChanged event does fire, and checking the row property of the event argument I can verify all the data in that row is correct. However, a that point, all the dataset methods don't seem to "see" that row. Very strange because the row is being showed on the datagrid. More strange, if I make any other change, the row becomes "available". It was driving me crazy because a Select method executed on the datatable would not return the newly added row, but it would if other change was made subsequently. Just to be sure, in the RowChangedEvent I saved the dataset at that stage using the WriteXml method, then I looked at it and it did not include the new row. But if I check the count property of the datatable, it has increased by one. so :doh: it seems that by the time the RowChangedEvent is fired, the row is not available to the dataset methods even though the row IS available to the dataview :wtf: to make things even weirder. I have some code that checks for data integrity in the RowChanged event, if the data is wrong is display a message box and then calls the RejectChanges() method of the row. That in turn triggers the event again and it exits the procedure because the row is null. Now if that happens (meaning, if I enter wrong data to trigger the rollback) all subsequent insertions work fine. even weirder, if I exclude the event handler before calling RejectChanges() (so the RowChanged event won't be trigger by the rollback) the problem persists, meaning new rows are not "seen". this does not make any sense to me, and only happens if I do my calculations from the RowChanged event. If I add a button and use the button's click event it's fine, so it looks that when the RowChanged event is fired, the new row is in a sort of intermediate state (not the added state but some unforseen state). This looks like a bug, but I really have no clue what's going on. I hope this is understandable, it's so weird that I can't make any sense of it.

    S 1 Reply Last reply
    0
    • R ricardojb

      I'll try to explain this. I have a Windows form with a datagrid. The datagrid binding has been set as MyDataGrid.SetDataBinding(MyDataView, "") The dataview has also a RowFilter to show only some records. Now, the problem is that I need to do some calculations whenever something is changed in that table. For that I use the RowChanged and RowDeleted events. Now, I have no problems with rows deleted, or rows that are modified, but I do with rows added. When I add a new row, the RowChanged event does fire, and checking the row property of the event argument I can verify all the data in that row is correct. However, a that point, all the dataset methods don't seem to "see" that row. Very strange because the row is being showed on the datagrid. More strange, if I make any other change, the row becomes "available". It was driving me crazy because a Select method executed on the datatable would not return the newly added row, but it would if other change was made subsequently. Just to be sure, in the RowChangedEvent I saved the dataset at that stage using the WriteXml method, then I looked at it and it did not include the new row. But if I check the count property of the datatable, it has increased by one. so :doh: it seems that by the time the RowChangedEvent is fired, the row is not available to the dataset methods even though the row IS available to the dataview :wtf: to make things even weirder. I have some code that checks for data integrity in the RowChanged event, if the data is wrong is display a message box and then calls the RejectChanges() method of the row. That in turn triggers the event again and it exits the procedure because the row is null. Now if that happens (meaning, if I enter wrong data to trigger the rollback) all subsequent insertions work fine. even weirder, if I exclude the event handler before calling RejectChanges() (so the RowChanged event won't be trigger by the rollback) the problem persists, meaning new rows are not "seen". this does not make any sense to me, and only happens if I do my calculations from the RowChanged event. If I add a button and use the button's click event it's fine, so it looks that when the RowChanged event is fired, the new row is in a sort of intermediate state (not the added state but some unforseen state). This looks like a bug, but I really have no clue what's going on. I hope this is understandable, it's so weird that I can't make any sense of it.

      S Offline
      S Offline
      sreejith ss nair
      wrote on last edited by
      #2

      :doh: Sreejith Nair [ My Articles ]

      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