dotConnect for SQLite Documentation
Devart.Common Namespace / DbDataTable Class / BeginFill Method
The delegate to call when the asynchronous invoke is complete. If callback is a null reference (Nothing in Visual Basic), the delegate is not called.
State information that is passed on to the delegate.
Example

In This Topic
    BeginFill Method
    In This Topic
    Starts an asynchronous invocation of the Fill() method.
    Syntax
    'Declaration
     
    Public Function BeginFill( _
       ByVal callback As AsyncCallback, _
       ByVal stateObject As Object _
    ) As IAsyncResult
    public IAsyncResult BeginFill( 
       AsyncCallback callback,
       object stateObject
    )

    Parameters

    callback
    The delegate to call when the asynchronous invoke is complete. If callback is a null reference (Nothing in Visual Basic), the delegate is not called.
    stateObject
    State information that is passed on to the delegate.

    Return Value

    An System.IAsyncResult interface that represents the asynchronous operation started by calling this method.
    Remarks

    Refer to "Asynchronous Query Execution" topic for detailed information.

    If the suspended fetch is stopped with EndFill method, the BeginFill method will start the fetch from the point where the fetch was stopped. To make BeginFill starting the query from the beginning, use the CancelFetch method.

    Example
    The following example demonstrates how to use the BeginFill method.
    static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection) {
    
      myDataTable.Connection = myConnection;
      myDataTable.SelectCommand = myConnection.CreateCommand();
      myDataTable.SelectCommand.CommandText = "SELECT * FROM Dept";
    
      IAsyncResult aRes = myDataTable.BeginFill(null, null);
    
      Console.Write("Fetch in process");
    
      Thread.Sleep(100);
      myDataTable.SuspendFill(true);
      Console.Write("Fetch is stopped");
    
      myDataTable.EndFill(aRes);
      Console.Write("All records are fetched");
    }
    Private Shared Sub UseDataTable3(ByVal myDataTable As DbDataTable, ByVal myConnection As DbConnection)
      myDataTable.Connection = myConnection
      myDataTable.SelectCommand = myConnection.CreateCommand
      myDataTable.SelectCommand.CommandText = "SELECT * FROM Dept"
      Dim result1 As IAsyncResult = myDataTable.BeginFill(Nothing, Nothing)
      Console.Write("Fetch in process")
      Thread.Sleep(100)
      myDataTable.SuspendFill(True)
      Console.Write("Fetch is stopped")
      myDataTable.EndFill(result1)
      Console.Write("All records are fetched")
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also