I am getting a strange exception when trying to update a DataTable after flagging a row for deletion. It looks like it's validating the data in the row I'm trying to delete. I was able to save the same row successfully, why won't it let me delete it?
Using C# in VS 2008 and SQL Server CE.
The essential bits (I hope) of my code:
var listDataTable = new booksDataSet.ListDataTable();
this.tableAdapterManager1.ListTableAdapter.Fill(listDataTable);
listDataTable.Rows[0].Delete();
this.tableAdapterManager1.ListTableAdapter.Update(listDataTable);
booksDataSet1.List.AcceptChanges(); // exception here
The exception is: System.FormatException was unhandled Message="@p2 : foo - Input string was not in a correct format." Source="System.Data"
I've reduced this to a very simple table: Id (PK, int, not null) Name (nvarchar(100), not null) Notes (nvarchar(4000), null)
The data in the row I'm trying to delete (first row) is Name = "foo", so it is the correct row, but why does it care what the data is before deleting the row?