System.Data.Common Namespace DataTableMappingCollection Class
Returns the number of DataTableMapping objects in the collection.
Script |
[ integer variable = ] DataTableMappingCollection.Count |
variable |
Integer specifying the total number of DataTableMapping objects in the collection. |
The property is read only with no default value.
ICollection.Count
Use the Count property to determine the number of DataTableMapping objects contained in the DataTableMappingCollection of a specified DataAdapter object. Count is commonly used when iterating through the collection to determine the upper bound of a loop.
The following example demonstrates using the Count property to determine the upper bound of a DataTableMappingCollection. This value is then used to iterate though the collection.
void getTableMappings ( DataAdapter myAdapter ) {
// get table mappings
DataTableMappingCollection myTables = myAdapter.TableMappings;
string myMessage = "Table Mappings:\n";
for ( int i=0; i < myTables.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myTables [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub getTableMappings ( ByVal myAdapter As DataAdapter )
' get table mappings
Dim myTables As DataTableMappingCollection = myAdapter.TableMappings
Dim myMessage As String = "Table Mappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To myTables.Count - 1
myMessage += i.ToString ( ) + " " + myTables ( i ).ToString ( ) + ControlChars.Cr
Next i
Response.Write ( myMessage )
End Sub |
|
C# |
VB |
DataTableMappingCollection Members