Search code examples
c#vb.netado.netprogresstableadapter

How to report progress from TableAdapter.Update


I am writing some data to my Database using TableAdpater.Update and the operation can take up to one minute to complete.

Is there some way to report the progress of this to the user because they think it has stopped responding.


Solution

  • One option might be to implement a Custom TableAdapter class and override 'Update' ( Sorry for the VB.NET - its just what I had open )

    Public Class CustomDataAdapter : Inherits DataAdapter
         Public Overrides Function Update(dataSet As System.Data.DataSet) As Integer
                For Each row In dataSet.Tables(x).Rows
                    ' Insert/Update into table
                    ' Callback to a progressbar updater
                Next
            End Function
    End Class