HELP!
The issue is when the user adds a row it throws an unhandled exception of type 'System.Data.Co nstraintExcepti on' occurred in System.Data.dll , but the only constraints that the DB has is that none of the columns can be null. But the user has not finished entering in the information into the datagridview yet so some of the colums will be null. I don't know what the heck is going on with this. I'm at my wits end....MSDN sucks.
Code:
private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e)
{
MessageBox.Show("dataGridView1_UserAddedRow");
if (this.bookDataSet.HasChanges())
{
DataSet changes = this.bookDataSet.GetChanges();
this.booksTableAdapter.Connection.Open();
this.booksTableAdapter.Update((BookApplication.bookDataSet)changes);
this.booksTableAdapter.Connection.Close();
this.bookDataSet.Merge(changes, true, MissingSchemaAction.Add);
DataRow[] errRows = this.bookDataSet.Tables["books"].GetErrors();
foreach (DataRow errRow in errRows)
{
errRow.RejectChanges();
errRow.RowError = null;
}
this.bookDataSet.AcceptChanges();
}
}
Comment