System.Data.Common Namespace DataColumnMappingCollection Class
Sets or retrieves the DataColumnMapping from the collection at the specified index.
DataColumnMapping variable = DataColumnMappingCollection.Item [ index ];
... or ...
DataColumnMapping variable = DataColumnMappingCollection [ index ];
dim variable as DataColumnMapping = DataColumnMappingCollection.Item ( index )
... or ...
dim variable as DataColumnMapping = DataColumnMappingCollection ( index )
variable : DataColumnMapping = DataColumnMappingCollection.Item ( index );
... or ...
variable : DataColumnMapping = DataColumnMappingCollection ( index ); |
|
C# |
VB |
JScript |
- index
- The index of the DataColumnMapping to return.
The DataColumnMapping at the specified index.
Exception Type |
Condition |
IndexOutOfRangeException |
Occurs when the index value is greater than the number of items in the collection. |
Use the Contains method to test for the existence of a specific DataColumnMapping.
The following example demonstrates using the Item property to print the values of each DataColumnMapping object in the collection.
void getColumnMappings ( DataTableMapping myTableMap ) {
// get column mappings
DataColumnMappingCollection myFieldMaps = myTableMap.ColumnMappings;
string myMessage = "Column Mappings:\n";
for ( int i=0; i < myFieldMaps.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myFieldMaps [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub getColumnMappings ( ByVal myTableMap As DataTableMapping )
' get column mappings
Dim myFieldMaps As DataColumnMappingCollection = myTableMap.ColumnMappings
Dim myMessage As String = "Column Mappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To myFieldMaps.Count - 1
myMessage += i.ToString ( ) + " " + myFieldMaps ( i ).ToString ( ) + ControlChars.Cr
Next i
Response.Write ( myMessage )
End Sub |
|
C# |
VB |
DataColumnMappingCollection Members DataColumnMappingCollection.Item Overload List