asp.net.ph

DataColumnMappingCollection GetColumnMappingBySchemaAction Method

System.Data.Common Namespace   DataColumnMappingCollection Class


Returns a DataColumnMapping for the specified DataColumnMappingCollection, SourceColumn name, and MissingMappingAction.

[ VB ]
Public Shared Function GetColumnMappingBySchemaAction ( _
   ByVal columnMappings As DataColumnMappingCollection, _
   ByVal sourceColumn As String, _
   ByVal mappingAction As MissingMappingAction _
) As DataColumnMapping

[ C# ]
public static DataColumnMapping GetColumnMappingBySchemaAction (
   DataColumnMappingCollection columnMappings,
   string sourceColumn,
   MissingMappingAction mappingAction
);

[ C++ ]
public: static DataColumnMapping* GetColumnMappingBySchemaAction (
   DataColumnMappingCollection* columnMappings,
   String* sourceColumn,
   MissingMappingAction mappingAction
);

[ JScript ]
public static function GetColumnMappingBySchemaAction (
   columnMappings : DataColumnMappingCollection,
   sourceColumn : String,
   mappingAction : MissingMappingAction
) : DataColumnMapping

Parameters

columnMappings
The DataColumnMappingCollection.
sourceColumn
The case-sensitive name of a SourceColumn to find.
mappingAction
One of the MissingMappingAction values.

Return Value

A DataColumnMapping object.

Exceptions


Exception Type Condition
InvalidOperationException The mappingAction parameter was set to Error, and no mapping was specified.

Remarks

If the DataColumnMapping exists in the collection, it is returned.

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

Example

The following example demonstrates using the GetColumnMappingBySchemaAction method to return a specified DataColumnMapping object.

public void FindDataColumnMapping ( DataTableMapping myTableMap ) {
   // get column mappings
   DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
   if ( myFieldsMaps.Contains ( "Description" ) ) {
      DataColumnMapping myFieldMap = 
         DataColumnMappingCollection.GetColumnMappingBySchemaAction 
            ( myFieldsMaps, "Description", MissingMappingAction.Ignore );
   }
}
  C# VB

See Also

DataColumnMappingCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph