QueryRecordCount Property
Determines whether
DbDataTable should perfrom additional request to determine quantity of records in the result set.
public bool QueryRecordCount {get; set;}
'Declaration
Public Property QueryRecordCount As Boolean
Property Value
If
true, an additional request to server is executed, and the
RecordCount is updated.
The following example demonstrates how to use the
QueryRecordCount property.
static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection) {
myDataTable.Connection = myConnection;
myDataTable.SelectCommand = myConnection.CreateCommand();
myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.Dept";
myDataTable.QueryRecordCount = false;
myDataTable.Active = true;
int count = myDataTable.RecordCount; //the number of currently fetched rows
myDataTable.Active = false;
myDataTable.QueryRecordCount = true;
myDataTable.Active = true;
count = myDataTable.RecordCount; //the real number of rows in the table
myDataTable.Active = false;
}
Private Shared Sub UseDataTable5(ByVal myDataTable As DbDataTable, ByVal myConnection As DbConnection)
myDataTable.Connection = myConnection
myDataTable.SelectCommand = myConnection.CreateCommand
myDataTable.SelectCommand.CommandText = "SELECT * FROM Test.Dept"
myDataTable.QueryRecordCount = False
myDataTable.Active = True
Dim num1 As Integer = myDataTable.RecordCount 'the number of currently fetched rows
myDataTable.Active = False
myDataTable.QueryRecordCount = True
myDataTable.Active = True
num1 = myDataTable.RecordCount 'the real number of rows in the table
myDataTable.Active = False
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