dotConnect for PostgreSQL Documentation
Devart.Common Namespace / DbDataTable Class / EndFill Method
The System.IAsyncResult returned from BeginFill.
Example

EndFill Method
Ends an asynchronous invocation of the Fill() method.
Syntax
'Declaration
 
Public Sub EndFill( _
   ByVal result As IAsyncResult _
) 
 

Parameters

result
The System.IAsyncResult returned from BeginFill.
Remarks

This method returns when the asynchronous fill operation is complete.

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

If the fetch is suspended by the SuspendFill method and then stopped by the 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 EndFill method.
static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection) {

  myDataTable.Connection = myConnection;
  myDataTable.SelectCommand = myConnection.CreateCommand();
  myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.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 Test.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
See Also