System.Data.Common Namespace DataColumnMappingCollection Class
Returns the number of DataColumnMapping objects in the collection.
Script |
[ integer variable = ] DataColumnMappingCollection.Count |
variable |
Integer specifying the total number of DataColumnMapping objects in the collection. |
The property is read only with no default value.
ICollection.Count
Use the Count property to determine the number of DataColumnMapping objects contained in the DataColumnMappingCollection of a specified DataTableMapping 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 DataColumnMappingCollection. This value is then used to iterate though the collection.
void getColumnMappings ( DataTableMapping myTableMap ) {
// get column mappings
DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
string myMessage = "Column Mappings:\n";
for ( int i=0; i < myFieldsMaps.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myFieldsMaps [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub getColumnMappings ( ByVal myTableMap As DataTableMapping )
' get column mappings
Dim myFieldsMaps As DataColumnMappingCollection = myTableMap.ColumnMappings
Dim myMessage As String = "Column Mappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To myFieldsMaps.Count - 1
myMessage += i.ToString ( ) + " " + myFieldsMaps ( i ).ToString ( ) + ControlChars.Cr
Next i
Response.Write ( myMessage )
End Sub |
|
C# |
VB |
DataColumnMappingCollection Members