'Declaration Public Overrides Property FetchAll As Boolean
public override bool FetchAll {get; set;}
'Declaration Public Overrides Property FetchAll As Boolean
public override bool FetchAll {get; set;}
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.
static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection, DataGrid dataGrid) { myDataTable.Connection = myConnection; myDataTable.SelectCommand = myConnection.CreateCommand(); myDataTable.SelectCommand.CommandText = "SELECT * FROM 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 Dept" myDataTable.FetchAll = True myDataTable.CachedUpdates = False myDataTable.Active = True dataGrid.DataSource = myDataTable End Sub
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