Still detached after update

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

This is pretty general code. it works first time and not second, state
is still detached after the update. There are no events linked up so
there is nothing special about this. There are no messages in the
DataRow either. Any suggestions?

DBRow.EndEdit();
source.EndEdit();
TheTableAdapter.Update(DBRow);
if (NewValue)
TheTableAdapter.Update(MyDataset.MyTable);

if (DBRow.RowState != DataRowState.Unchanged)
throw new Exception("Update failed on row");
 
This is pretty general code. it works first time and not second, state
is still detached after the update. There are no events linked up so
there is nothing special about this. There are no messages in the
DataRow either. Any suggestions?

DBRow.EndEdit();
if (NewBall)
source.MoveLast();
source.EndEdit();
TheTableAdapter.Update(DBRow);
if (NewValue)
TheTableAdapter.Update(MyDataset.MyTable);

if (DBRow.RowState != DataRowState.Unchanged)
throw new Exception("Update failed on row");


Two lines fixed it. If I update a detached row in the table manager
surely it should automatically attach it.
 
Back
Top