So I started wondering why it takes 3.5 seconds to
AcceptChanges for one changed record in a large
DataTable. I wrote another implementation of
AcceptChanges (VB.NET) -
Me is a
Public Shadows Sub AcceptChanges() 'this way AcceptChanges is 35 to 700 faster than Microsoft's way '35 is a speed factor when all rows were changed, and 700 is when a few 'Tested on sets of 13K and 65K records Dim updatedRows() As DataRow = Me.Select(Nothing, Nothing, _ DataViewRowState.Added Or DataViewRowState.Deleted Or _ DataViewRowState.ModifiedCurrent Or DataViewRowState.ModifiedOriginal) For Each row As DataRow In updatedRows row.AcceptChanges() Next End Sub
It appears to be from 35 to 700 times faster than Microsoft's implementation. Did I just uncover/solve a great mystery of ADO.NET, or am I missing something here?