DataTableMapping.GetColumnMappingBySchemaAction Method

Definition

Gets a DataColumn from the specified DataTable using the specified MissingMappingAction value and the name of the DataColumn.

public:
 System::Data::Common::DataColumnMapping ^ GetColumnMappingBySchemaAction(System::String ^ sourceColumn, System::Data::MissingMappingAction mappingAction);
public System.Data.Common.DataColumnMapping? GetColumnMappingBySchemaAction (string sourceColumn, System.Data.MissingMappingAction mappingAction);
public System.Data.Common.DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, System.Data.MissingMappingAction mappingAction);
member this.GetColumnMappingBySchemaAction : string * System.Data.MissingMappingAction -> System.Data.Common.DataColumnMapping
Public Function GetColumnMappingBySchemaAction (sourceColumn As String, mappingAction As MissingMappingAction) As DataColumnMapping

Parameters

sourceColumn
String

The name of the DataColumn.

mappingAction
MissingMappingAction

One of the MissingMappingAction values.

Returns

A data column.

Exceptions

The mappingAction parameter was set to Error, and no mapping was specified.

Remarks

If the DataColumnMapping exists, it is returned.

If the DataColumnMapping does not exist, 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.

Applies to

See also