DataColumnMappingCollection.GetColumnMappingBySchemaAction(DataColumnMappingCollection, String, MissingMappingAction) メソッド
定義
指定した DataColumnMapping、ソース列名、および DataColumnMappingCollection を使用して、MissingMappingAction を取得します。Gets a DataColumnMapping for the specified DataColumnMappingCollection, source column name, and MissingMappingAction.
public:
static System::Data::Common::DataColumnMapping ^ GetColumnMappingBySchemaAction(System::Data::Common::DataColumnMappingCollection ^ columnMappings, System::String ^ sourceColumn, System::Data::MissingMappingAction mappingAction);
public static System.Data.Common.DataColumnMapping? GetColumnMappingBySchemaAction (System.Data.Common.DataColumnMappingCollection? columnMappings, string sourceColumn, System.Data.MissingMappingAction mappingAction);
public static System.Data.Common.DataColumnMapping GetColumnMappingBySchemaAction (System.Data.Common.DataColumnMappingCollection columnMappings, string sourceColumn, System.Data.MissingMappingAction mappingAction);
static member GetColumnMappingBySchemaAction : System.Data.Common.DataColumnMappingCollection * string * System.Data.MissingMappingAction -> System.Data.Common.DataColumnMapping
Public Shared Function GetColumnMappingBySchemaAction (columnMappings As DataColumnMappingCollection, sourceColumn As String, mappingAction As MissingMappingAction) As DataColumnMapping
パラメーター
- columnMappings
- DataColumnMappingCollection
DataColumnMappingCollection。The DataColumnMappingCollection.
- sourceColumn
- String
検索するソース列名。大文字と小文字が区別されます。The case-sensitive source column name to find.
- mappingAction
- MissingMappingAction
MissingMappingAction 値のいずれか 1 つ。One of the MissingMappingAction values.
戻り値
DataColumnMapping オブジェクト。A DataColumnMapping object.
例外
mappingAction
パラメーターが Error
に設定され、マップが指定されませんでした。The mappingAction
parameter was set to Error
, and no mapping was specified.
例
次の例では、 DataColumnMapping コレクション内の指定されたソース列名を持つを検索します。The following example searches for a DataColumnMapping with the given source column name within the collection. オブジェクトが存在する場合は、そのオブジェクトが返されます。If the object exists, it is returned. この例では、 DataColumnMappingCollection コレクションと DataColumnMapping オブジェクトが作成されていることを前提としています。The example assumes that a DataColumnMappingCollection collection and a DataColumnMapping object have been created.
public void FindDataColumnMapping()
{
// ...
// create mappings and mapping
// ...
if (mappings.Contains("Description"))
mapping = DataColumnMappingCollection.GetColumnMappingBySchemaAction
(mappings, "Description", MissingMappingAction.Ignore);
}
Public Sub FindDataColumnMapping()
' ...
' create mappings and mapping
' ...
If mappings.Contains("Description") Then
mapping = _
DataColumnMappingCollection.GetColumnMappingBySchemaAction _
(mappings, "Description", MissingMappingAction.Ignore)
End If
End Sub
注釈
が DataColumnMapping コレクション内に存在する場合は、それが返されます。If the DataColumnMapping exists in the collection, it is returned.
が DataColumnMapping コレクション内に存在しない場合、指定されたに対して MissingMappingAction 次のアクションが発生します。If the DataColumnMapping does not exist in the collection, for a given MissingMappingAction, the following actions occur:
MissingMappingActionMissingMappingAction | 実行されたアクションAction Taken |
---|---|
Passthrough |
ソース列名 DataColumnMapping と列名の両方として、指定したソース列名を持つを作成し DataSet ます。Creates a DataColumnMapping with the specified source column name as both the source column name and the DataSet column name. これ DataColumnMapping はコレクションに追加されません。This DataColumnMapping is not added to the collection. |
Error |
指定した列マップが存在しない場合は、InvalidOperationException が生成されます。An InvalidOperationException is generated if the specified column mapping is missing. |
Ignore |
Null 値を取得します。Gets a null value. |