G
Guest
Hi,
I have encountered the following problem.
Say I have the following,
DataGridView dgv;
DataTable dt;
OleDbDataAdapter oleDb_da; (bound to a OleDb data connection)
dt is the bounded data source of dgv, and I use oleDb_da.Fill(dt) to fill
the data table.
If I execute dt.Rows.RemoveAt(row_index), the row is removed, instead of
marked delete. When I run oleDb_da.Update(), my database is corrupted since
the deleted row is not updated in my database.
When I simply delete a row from my DataGridView dgv, the deleted row is
still in the collection, but marked deleted. When I run oleDb_da.Update(),
everything works correctly. I assume DataGridView delete (e.g. select a row
and click the button delete), must have execute DataRow.Delete().
Has anyone encountered above? Does anyone have an answer why
DataRowCollection.RemoveAt() fails in this scenario?
Thanks,
I have encountered the following problem.
Say I have the following,
DataGridView dgv;
DataTable dt;
OleDbDataAdapter oleDb_da; (bound to a OleDb data connection)
dt is the bounded data source of dgv, and I use oleDb_da.Fill(dt) to fill
the data table.
If I execute dt.Rows.RemoveAt(row_index), the row is removed, instead of
marked delete. When I run oleDb_da.Update(), my database is corrupted since
the deleted row is not updated in my database.
When I simply delete a row from my DataGridView dgv, the deleted row is
still in the collection, but marked deleted. When I run oleDb_da.Update(),
everything works correctly. I assume DataGridView delete (e.g. select a row
and click the button delete), must have execute DataRow.Delete().
Has anyone encountered above? Does anyone have an answer why
DataRowCollection.RemoveAt() fails in this scenario?
Thanks,