dotConnect for SQL Server Documentation
Devart.Common Namespace / DbDataTable Class / FetchAll Property
Example

In This Topic
    FetchAll Property (DbDataTable)
    In This Topic
    Determines whether data is requested from server entirely or partially.
    Syntax
    'Declaration
     
    Public Overridable Property FetchAll As Boolean
    public virtual bool FetchAll {get; set;}

    Property Value

    If true, the data is requested when the DbDataTable is opened, otherwise records are fetched only when necessary.
    Remarks

    The FetchAll property allows you to optimize application behavior depending on circumstances. For example, consider a situation when user requests large amount of data to be displayed in a grid. When FetchAll is true, the whole dataset is retrieved from server at once, and while navigating through the dataset no server roundtrips are necessary. Thus application less depends on network speed and stability. When FetchAll is false, only minimal quantity of rows is requested at once, which leads to better initial response time and less network traffic.

    Note that when FetchAll is true, fill operations can be asynchronous. Refer to NonBlocking property for more information.

    When FetchAll is false, it could be useful to determine rows quantity with the QueryRecordCount property.

    Example
    The following example demonstrates how to use the FetchAll property.
    static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection, DataGrid dataGrid) {
    
      myDataTable.Connection = myConnection;
      myDataTable.SelectCommand = myConnection.CreateCommand();
      myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.Dept";
      myDataTable.FetchAll = true;
      myDataTable.CachedUpdates = false;
      myDataTable.Active = true;
      dataGrid.DataSource = myDataTable;
    }
    Private Shared Sub UseDataTable(ByVal myDataTable As DbDataTable, ByVal myConnection As DbConnection, ByVal dataGrid As DataGrid)
      myDataTable.Connection = myConnection
      myDataTable.SelectCommand = myConnection.CreateCommand
      myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.Dept"
      myDataTable.FetchAll = True
      myDataTable.CachedUpdates = False
      myDataTable.Active = True
      dataGrid.DataSource = myDataTable
    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