System.Data.Common Namespace DataColumnMappingCollection Class
Removes a specified DataColumnMapping from the collection.
1. Removes the DataColumnMapping at the specified index.
2. Removes the DataColumnMapping with the specified SourceColumn name.
The following example first uses the Contains method to find a DataColumnMapping with the specified source column name within the ColumnMappings collection of a specifed DataTableMapping object. If the mapping exists, the example removes it.
NOTE: This example uses one of the overloaded versions of RemoveAt. For other examples that may be available, see the individual overload topics.
public void SearchColumnMappings ( DataTableMapping myTableMap ) {
DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
if ( myFieldsMaps.Contains ( "Picture" )
myFieldsMaps.RemoveAt ( "Picture" );
}
Public Sub SearchColumnMappings ( ByVal myTableMap As DataTableMapping )
Dim myFieldsMaps As DataColumnMappingCollection = myTableMap.ColumnMappings
If myFieldsMaps.Contains ( "Picture" ) Then
myFieldsMaps.RemoveAt ( "Picture" );
End If
End Sub |
|
C# |
VB |
DataColumnMappingCollection Members