J
Jon Pope
I've got a worker thread in which I'm updating a DataTable instance. Within
my main thread, I'm hosting a DataViewGrid, which is bound to a DataView
object derived from the DataTable instance by using
DataView dv = new DataView(<DataTableInstance>);
<DataGridViewObject>.DataSource = dv;
The interesting thing that I'm seeing occurs when the DataView has a
RowFilter set. I've got 10000 rows within my DataTable (within it is an
"Index" column which goes from 1 - 10000 sequentially). If I set my
DataView's RowFilter property to "Index > 1000", I expect my DataGridView to
display all records whose "Index" column > 1000; this works great. On my
background thread I begin to iterate through the DataRows updating values in
each row, from 1 - 10000. When I hit the rows > 1000, I'm expecting to see
the DataViewGrid dutifully reflect the changes I've been making. Instead, I
get the following error to appear:
DataGridView Default Error Dialog
The following exception occurred in the DataGridView:
System.Data.VersionNotFoundException: There is no Original data to access.
at System.Data.DataRow.GetOriginalRecordNo()
at System.Data.DataRow.GetRecordFromVersion(DataRowVersion version)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
at
System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetValue(Int32
boundColumnIndex, Int32 columnIndex, Int32 rowIndex)
What does this mean? I'm not deleting any rows, merely updating them.
Cheers, Jon
my main thread, I'm hosting a DataViewGrid, which is bound to a DataView
object derived from the DataTable instance by using
DataView dv = new DataView(<DataTableInstance>);
<DataGridViewObject>.DataSource = dv;
The interesting thing that I'm seeing occurs when the DataView has a
RowFilter set. I've got 10000 rows within my DataTable (within it is an
"Index" column which goes from 1 - 10000 sequentially). If I set my
DataView's RowFilter property to "Index > 1000", I expect my DataGridView to
display all records whose "Index" column > 1000; this works great. On my
background thread I begin to iterate through the DataRows updating values in
each row, from 1 - 10000. When I hit the rows > 1000, I'm expecting to see
the DataViewGrid dutifully reflect the changes I've been making. Instead, I
get the following error to appear:
DataGridView Default Error Dialog
The following exception occurred in the DataGridView:
System.Data.VersionNotFoundException: There is no Original data to access.
at System.Data.DataRow.GetOriginalRecordNo()
at System.Data.DataRow.GetRecordFromVersion(DataRowVersion version)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
at
System.Windows.Forms.DataGridView.DataGridViewDataConnection.GetValue(Int32
boundColumnIndex, Int32 columnIndex, Int32 rowIndex)
What does this mean? I'm not deleting any rows, merely updating them.
Cheers, Jon