System.Data.Common Namespace DataTableMapping Class
Returns a DataColumnMapping with the specified SourceColumn name and MissingMappingAction.
[ VB ]
Public Function GetColumnMappingBySchemaAction ( _
ByVal sourceColumn As String, _
ByVal mappingAction As MissingMappingAction _
) As DataColumnMapping
[ C# ]
public DataColumnMapping GetColumnMappingBySchemaAction (
string sourceColumn,
MissingMappingAction mappingAction
);
[ C++ ]
public: DataColumnMapping* GetColumnMappingBySchemaAction (
String* sourceColumn,
MissingMappingAction mappingAction
);
[ JScript ]
public function GetColumnMappingBySchemaAction (
columnMappings : DataTableMapping,
sourceColumn : String,
mappingAction : MissingMappingAction
) : DataColumnMapping;
- sourceColumn
- The case-sensitive name of a SourceColumn to find.
- mappingAction
- One of the MissingMappingAction values.
A DataColumnMapping object.
If the DataColumnMapping exists, it is returned. Otherwise, for a given MissingMappingAction, the following happens:
MissingMappingAction |
Action Taken |
Passthrough |
This method initializes a DataColumnMapping with the given source column name as both the source column name and the DataSet column name. This DataColumnMapping is not added to the collection. |
Error |
An exception is generated. |
Ignore |
Gets a null. |
The following example demonstrates using the GetColumnMappingBySchemaAction method to return a specified DataColumnMapping object.
public void FindDataTableMapping ( DataTableMapping myTable ) {
// get column mappings
DataColumnMappingCollection myFields = myTable.ColumnMappings;
if ( myFields.Contains ( "Description" ) ) {
DataColumnMapping myField =
myTable.GetColumnMappingBySchemaAction
( "Description", MissingMappingAction.Ignore );
}
}
Public Sub FindDataTableMapping ( ByVal myTable As DataTableMapping )
' get column mappings
Dim myFields As DataColumnMappingCollection = myTable.ColumnMappings;
If myFields.Contains ( "Description" ) Then
Dim myField As DataColumnMapping = _
myTable.GetColumnMappingBySchemaAction _
( "Description", MissingMappingAction.Ignore )
End If
End Sub |
|
C# |
VB |
DataTableMapping Members