DataColumnMappingCollection::GetColumnMappingBySchemaAction Method (DataColumnMappingCollection^, String^, MissingMappingAction)
Gets a DataColumnMapping for the specified DataColumnMappingCollection, source column name, and MissingMappingAction.
Assembly: System.Data (in System.Data.dll)
public: static DataColumnMapping^ GetColumnMappingBySchemaAction( DataColumnMappingCollection^ columnMappings, String^ sourceColumn, MissingMappingAction mappingAction )
Parameters
- columnMappings
- Type: System.Data.Common::DataColumnMappingCollection^
- sourceColumn
-
Type:
System::String^
The case-sensitive source column name to find.
- mappingAction
-
Type:
System.Data::MissingMappingAction
One of the MissingMappingAction values.
| Exception | Condition |
|---|---|
| InvalidOperationException | The mappingAction parameter was set to Error, and no mapping was specified. |
If the DataColumnMapping exists in the collection, it is returned.
If the DataColumnMapping does not exist in the collection, for a given MissingMappingAction, the following actions occur:
MissingMappingAction | Action Taken |
|---|---|
Passthrough | Creates a DataColumnMapping with the specified source column name as both the source column name and the DataSet column name. This DataColumnMapping is not added to the collection. |
Error | An InvalidOperationException is generated if the specified column mapping is missing. |
Ignore | Gets a null value. |
The following example searches for a DataColumnMapping with the given source column name within the collection. If the object exists, it is returned. The example assumes that a DataColumnMappingCollection collection and a DataColumnMapping object have been created.
Available since 1.1