none
how to: keep UI responsive while data load ? RRS feed

  • Question

  • Hi All,

    how to keep UI responsive, while accessing data stored in a database, using ADO.net's generic DataSets?

     

    I have a straight application, using regular ADO.net's TableAdapters. When data loadm or any other data operation in progress, for example SProcedure executed via ExecuteScalar, I experience delays.

     

    I've learned so far, that to keep UI responsive, I need to execute time-consuming-work (in this case: data access) on a separate thread. So I do:

     

    Code Snippet

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

     

    MyTableAdapter.Fill(Me.MyDataSet.MyTable)

     

    End Sub

     

     

    But this above makes data load on BackgroundWorker's thread, so loaded TableAdapter is invisible in the main thread.

     

    How do you handle such things, I mean 'waiting for data' ?

    Any help greatly appreciated.

    Monday, September 24, 2007 4:29 PM