Problem updating a dataset table row

  • Thread starter Thread starter Karl
  • Start date Start date
K

Karl

Hi,

I am working with a dataset and want to update a row and
then call the appropriate adapter.update method to update
the source table.

This is how I am updating the row:
row = dataSet.Tables["tablename"].Rows.Find(rowId);
row["col1"] = newValue1;
row["col2"] = newValue2;

This changes the row's values and updates all child
records ok BUT when I come to apply the changes to the
source I get an error:
"Concurrency violation: the UpdateCommand affected 0
records."

Please help
 
Hi Karl,

That's probably because you are modifying your primary key (col1?).
The adapter checks if the row exists in database before updating - see
"where" part of "update" sql statament.
 
Back
Top