Reputation: 59
I try this
DataSet ds = new DataSet();
ds.AcceptChanges();
//edit table in ds
ds.Tables[0].Rows.RemoveAt(0);
//get changes
DataSet ds2 = ds.GetChanges();
but ds2 is null, why?
Upvotes: 1
Views: 1568
Reputation: 273574
Use Delete instead of RemoveAt:
//ds.Tables[0].Rows.RemoveAt(0);
ds.Tables[0].Rows[0].Delete();
RemoveAt() really removes the Row, there is no trace of it left and hence there is no Change information. Delete() just marks the row as deleted.
Upvotes: 1
Reputation: 29520
Maybe the table was already empty, do removing the first row didn't change anything?
Upvotes: 0