N
nvx
Hello there,
I need an advice on "re-adding the deleted rows" in a DataTable. The
situation is as follows:
1. I have a data-bound DataGridView.
2. User wants to delete a row with a key value "KEY", therefore this
row gets deleted using
DataRow row = dataSet.Tables["data"].Rows.Find("KEY");
row.Delete();
3. The deleted row is still in the DataTable, but with
DataRowState.Deleted.
4. Now, user decides to add a row with the same key value again, so he
types it into the DataGridView. At this moment, there are TWO rows
with the same key value "KEY": one with DataRowState.Deleted and one
with DataRowState.Added.
5. User wants to save the data into the .mdb file, therefore
tableAdapter.Update(...) is called ending up with a concurrency error
saying that the UpdateCommand event caused 0 out of 1 records to
update (or something similar, I unfortunately don't have an English
version of .NET).
What should I do with these two DataRows to be able to use the
Update(...) command later on?
Any help will be much appreciated.
Best regards,
nvx
I need an advice on "re-adding the deleted rows" in a DataTable. The
situation is as follows:
1. I have a data-bound DataGridView.
2. User wants to delete a row with a key value "KEY", therefore this
row gets deleted using
DataRow row = dataSet.Tables["data"].Rows.Find("KEY");
row.Delete();
3. The deleted row is still in the DataTable, but with
DataRowState.Deleted.
4. Now, user decides to add a row with the same key value again, so he
types it into the DataGridView. At this moment, there are TWO rows
with the same key value "KEY": one with DataRowState.Deleted and one
with DataRowState.Added.
5. User wants to save the data into the .mdb file, therefore
tableAdapter.Update(...) is called ending up with a concurrency error
saying that the UpdateCommand event caused 0 out of 1 records to
update (or something similar, I unfortunately don't have an English
version of .NET).
What should I do with these two DataRows to be able to use the
Update(...) command later on?
Any help will be much appreciated.
Best regards,
nvx