asp.net.ph

DataColumnMappingCollection.Remove Method

System.Data.Common Namespace   DataColumnMappingCollection Class


Removes the specified DataColumnMapping from the collection.

[ VB ]
NotOverridable Public Sub Remove ( _
   ByVal column As Object _
) Implements IList.Remove

[ C# ]
public void Remove (
   Object column
);

[ C++ ]
public: __sealed void Remove (
   Object* column
);

[ JScript ]
public function Remove (
   column : Object
);

Parameters

column
The DataColumnMapping to remove.

Implements

IList.Remove

Exceptions


Exception Type Condition
InvalidCastException The object specified is not a DataColumnMapping object.
ArgumentException The object specified is not in the collection.

Remarks

Use this method to remove a given DataColumnMapping object from the ColumnMappings collection of a specified DataTableMapping object.

To remove a DataColumnMapping at a specified index in the collection, use the RemoveAt method. To remove all members of the collection at once, use the Clear method.

This method also resets the ColumnMappings.Count property.

Example

The following example first uses the Contains method to determine if a particular column mapping exists in the collection. If found, the column mapping is removed with the Remove method.

private void RemoveColumnMapping ( DataTableMapping myTableMap, object myFieldMap ) {
   // get the DataColumnMappingCollection of a DataTableMapping
   DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
   if ( myFieldsMaps.Contains ( myFieldMap ) {
      myFieldsMaps.Remove ( myFieldMap );
   }
}
  C# VB

See Also

DataColumnMappingCollection Members   Add   Clear   Contains Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph