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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top