DataColumnMappingCollection.GetColumnMappingBySchemaAction(DataColumnMappingCollection, String, MissingMappingAction) DataColumnMappingCollection.GetColumnMappingBySchemaAction(DataColumnMappingCollection, String, MissingMappingAction) DataColumnMappingCollection.GetColumnMappingBySchemaAction(DataColumnMappingCollection, String, MissingMappingAction) DataColumnMappingCollection.GetColumnMappingBySchemaAction(DataColumnMappingCollection, String, MissingMappingAction) Method

정의

지정된 DataColumnMappingDataColumnMappingCollection, 소스 열 이름 및 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);
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

매개 변수

sourceColumn
String String String String

찾을 대/소문자 구분 소스 열 이름입니다.The case-sensitive source column name to find.

반환

예외

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.

적용 대상

추가 정보