title: How to test a DataTable update in RowChanging event handler
body: <p>I have a WPF DataGrid bound to a DataTable. I fill the underlying DataSet from an arbitrary table in a database. I've attached to both the DataTable <code>RowChanging</code> and <code>RowChanged</code> events. As the user changes a row, these events fire and allow me to validate the row.</p>
  
  <p>To get the optimal behavior from the DataGrid, it seems apparent to me that the <code>e.Row.RowError</code> message should be set and and exception thrown from the <code>RowChanging</code> event handler. I have some xaml that marks the row as error in the row header so it's visible and I get a nice tooltip with the error message. By optimal, I mean that the escape sequences that one expects with these grids works as expected when the validation is handled as described. Trying to perform the same validation from the <code>RowChanged</code> event makes for some funky behavior that does not roll back the edits properly.</p>
  
  <p>The problem that I have is that I need to update the underlying DataSet so all the DB validation rules are applied and collisions with other user's changes can be detected in the <code>RowChanging</code> handler. If the action fails, I can flag the validation as described. But, the <code>e.Row.RowState</code> comes in as Unchanged and if I pass its containing DataSet to my DB update method, its <code>DataAdapter.Update(myDataTable)</code> method does not see the row as changed and, therefore, does nothing. This behavior contrasts with what would happens when I do the same in the <code>RowChanged</code> handler. At that point, the record (Current/Original/Proposed) values are updated and the record marked Modified. </p>
  
  <p>An DataAdapter update at that point results in database activity. But, I'm at the wrong point in the event sequence in the case of a failure. I can flag the error but the rollback behavior for the grid will not work correctly (typically results in the changed cells not rolling back).</p>
  
  <p>My question is, how does one get the record (or a copy of the record??) in the Modified state so the database will be updated? I normally use a typed DataSet but this time I am going after arbitrary tables and, therefore, am using a DataSet.</p>