DataTableMapping.GetColumnMappingBySchemaAction Method

Definition

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

C#
public System.Data.Common.DataColumnMapping? GetColumnMappingBySchemaAction(string sourceColumn, System.Data.MissingMappingAction mappingAction);
C#
public System.Data.Common.DataColumnMapping GetColumnMappingBySchemaAction(string sourceColumn, System.Data.MissingMappingAction mappingAction);

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

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also