Datatable internal index is corrupted ‘5’ – on Dataset save
24-Apr-1111 Leave a comment
See http://support.microsoft.com/kb/932491
Issue 5: When a Merge operation occurs, the record manager may become corrupted if the target row is in the edit state
I got this when i was repeatedly updating totals in databound text boxes from Detail rows into the Header table on every move or listchanged. Then bindingsource.addnew, then fill in data, then try and save giving error:- Datatable internal index is corrupted ‘5’
Solutions included:
- Remove data binding to text boxes. Write these when updating totals.
- Write totals to HeaderRow only if saving
- Also found that GetTotals was being called 3 times, on list clear, on parent bindingsource move, on fill detail.
Controlled this better by putting a SuspendRefreshFlag, before LoadDetail, then after load, GetTotal, Then SuspendRefreshFlag = False again. - Also in ListChanged event use the ByVal e As System.ComponentModel.ListChangedEventArgs
If e.ListChangedType <> System.ComponentModel.ListChangedType.Reset Then
GetSumFromDetail()
End If
Occurrences
- First occurrence at first writing of this post
- frmInvoiceDetail – Dec 2012
- was in ListChanged