dotConnect for DB2 Documentation
Devart.Common Namespace / DbDataTable Class / RowFetched Event
Example

In This Topic
    RowFetched Event
    In This Topic
    Occurs when another row is completely fetched.
    Syntax
    'Declaration
     
    Public Event RowFetched As EventHandler
    public event EventHandler RowFetched
    Example
    The following example demonstrates how to use the RowFetched event.
    static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection) {
    
      myDataTable.Connection = myConnection;
      myDataTable.SelectCommand = myConnection.CreateCommand();
      myDataTable.SelectCommand.CommandText = "SELECT * FROM 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 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