dotConnect for Oracle Documentation
Devart.Common Namespace / DbDataTable Class / FillPage Method / FillPage(Int32,Int32) Method
The number of the first row to retrieve. Value 0 means the first row, 1 means the second, and so on.
The maximum number of records to retrieve.
Example

In This Topic
    FillPage(Int32,Int32) Method
    In This Topic
    Fills the System.Data.DataTable.Rows collection of the DbDataTable with rows from the data source starting at the row indicated by startRecord and including up to the number of rows indicated by maxRecords.
    Syntax
    'Declaration
     
    Public Overloads Function FillPage( _
       ByVal startRecord As Integer, _
       ByVal maxRecords As Integer _
    ) As Integer
    public int FillPage( 
       int startRecord,
       int maxRecords
    )

    Parameters

    startRecord
    The number of the first row to retrieve. Value 0 means the first row, 1 means the second, and so on.
    maxRecords
    The maximum number of records to retrieve.

    Return Value

    The number of rows successfully added to or refreshed in the DbDataTable. This does not include rows affected by statements that do not return rows.
    Remarks
    This method clears any exisiting rows in the DbDataTable.
    Example
    This sample shows how to use paged access to data. It attempts to read rows 11 through 20 from the table and to display them. However, if quantity of records in the table is less than 20, only available rows will be filled into DbDataTable. Number of rows actually added is rendered to console.
    public void FillDataTable(DbDataTable myDataTable, IDbConnection myConnection)
    {
      myDataTable.Connection = myConnection;
      myDataTable.SelectCommand = myConnection.CreateCommand();
      myDataTable.SelectCommand.CommandText = "SELECT EmpNo, EName FROM Test.Emp";
      try
      {
        Console.WriteLine(myDataTable.FillPage(10,10) + " rows filled.");
        foreach(DataRow myRow in myDataTable.Rows)
        {
          foreach(DataColumn myCol in myDataTable.Columns)
          {
            Console.Write(myRow[myCol]+"\t");
          }
          Console.WriteLine();
        }
      }
      finally
      {
        myDataTable.Clear();
      }
    }
    Public Sub FillDataTable(ByVal myDataTable As DbDataTable, ByVal myConnection As IDbConnection)
      myDataTable.Connection = myConnection
      myDataTable.SelectCommand = myConnection.CreateCommand()
      myDataTable.SelectCommand.CommandText = "SELECT EmpNo, EName FROM Test.Emp"
      Try
        Console.WriteLine(myDataTable.FillPage(10, 10) & " rows filled.")
        Dim myRow As DataRow
        Dim myCol As DataColumn
        For Each myRow In myDataTable.Rows
          For Each myCol In myDataTable.Columns
            Console.Write(myRow(myCol) & Chr(9))
          Next myCol
          Console.WriteLine()
        Next myRow
      Finally
        myDataTable.Clear()
      End Try
    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