dotConnect for SQL Server Documentation
Devart.Common Namespace / DbDataTable Class / FetchFinished Event
Example

In This Topic
    FetchFinished Event
    In This Topic
    Occurs when a result set is completely fetched.
    Syntax
    'Declaration
     
    Public Event FetchFinished As EventHandler
    public event EventHandler FetchFinished
    Remarks
    This event is fired every time a fill operation is finished, regardless of the property or method that invoked the fetch process.
    Example
    The following example demonstrates how to use the FetchFinished event.
    static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection) {
    
      myDataTable.Connection = myConnection;
      myDataTable.SelectCommand = myConnection.CreateCommand();
      myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.Dept";
    
      myDataTable.RowFetched += new EventHandler(myDataTable_RowFetched);
      myDataTable.FetchFinished += new EventHandler(myDataTable_FetchFinished);
      myDataTable.Open();
    }
    
    static void myDataTable_RowFetched(object sender, EventArgs e) {
    
      Console.Write(string.Format("{0} rows are fetched", ((DbDataTable)sender).RecordCount));
    }
    
    static void myDataTable_FetchFinished(object sender, EventArgs e) {
      
      Console.Write("All records are fetched");
    }
    Private Shared Sub UseDataTable(ByVal myDataTable As DbDataTable, ByVal myConnection As DbConnection)
      myDataTable.Connection = myConnection
      myDataTable.SelectCommand = myConnection.CreateCommand
      myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.Dept"
      AddHandler myDataTable.RowFetched, New EventHandler(AddressOf Form1.myDataTable_RowFetched)
      AddHandler myDataTable.FetchFinished, New EventHandler(AddressOf Form1.myDataTable_FetchFinished)
      myDataTable.Open()
    End Sub
    
    Private Shared Sub myDataTable_RowFetched(ByVal sender As Object, ByVal e As EventArgs)
      Console.Write(String.Format("{0} rows are fetched", DirectCast(sender, DbDataTable).RecordCount))
    End Sub
    
    Private Shared Sub myDataTable_FetchFinished(ByVal sender As Object, ByVal e As EventArgs)
      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