S
Steve Loper
I can't find this documented anywhere, but it appears that you cannot
set the value of a field in a DataRowView more than once without
calling AcceptChanges or RejectChanges in the underlying DataTable.
Can anyone confirm this? Is this documented anywhere?
The following C# code snippet throws an exception on the last line:
DataRowView drv = (DataRowView)
this.BindingContext[myDataView].Current;
drv["NAME"] = "a";
drv["NAME"] = "b";
The following code works fine:
DataRowView drv = (DataRowView)
this.BindingContext[myDataView].Current;
drv["NAME"] = "a";
myDataView.Table.AcceptChanges();
drv["NAME"] = "b";
myDataView.Table.AcceptChanges();
The exception thrown in the fist case is as follows:
A first chance exception of type 'System.Data.DataException'
occurred in system.data.dll
Additional information: Cannot set NAME.
Thanks in advance,
Steve Loper
(e-mail address removed)
set the value of a field in a DataRowView more than once without
calling AcceptChanges or RejectChanges in the underlying DataTable.
Can anyone confirm this? Is this documented anywhere?
The following C# code snippet throws an exception on the last line:
DataRowView drv = (DataRowView)
this.BindingContext[myDataView].Current;
drv["NAME"] = "a";
drv["NAME"] = "b";
The following code works fine:
DataRowView drv = (DataRowView)
this.BindingContext[myDataView].Current;
drv["NAME"] = "a";
myDataView.Table.AcceptChanges();
drv["NAME"] = "b";
myDataView.Table.AcceptChanges();
The exception thrown in the fist case is as follows:
A first chance exception of type 'System.Data.DataException'
occurred in system.data.dll
Additional information: Cannot set NAME.
Thanks in advance,
Steve Loper
(e-mail address removed)