asp.net.ph

DataTableMappingCollection GetTableMappingBySchemaAction Method

System.Data.Common Namespace   DataTableMappingCollection Class


Returns the DataTableMapping object with the given SourceTable name and DataSetTable name, using the given MissingMappingAction.

[ VB ]
Public Shared Function GetTableMappingBySchemaAction ( _
   ByVal tableMappings As DataTableMappingCollection, _
   ByVal sourceTable As String, _
   ByVal dataSetTable As String, _
   ByVal mappingAction As MissingMappingAction _
) As DataTableMapping

[ C# ]
public static DataTableMapping GetTableMappingBySchemaAction (
   DataTableMappingCollection tableMappings,
   string sourceTable,
   string dataSetTable,
   MissingMappingAction mappingAction
);

[ C++ ]
public: static DataTableMapping* GetTableMappingBySchemaAction (
   DataTableMappingCollection* tableMappings,
   String* sourceTable,
   String* dataSetTable,
   MissingMappingAction mappingAction
);

[ JScript ]
public static function GetTableMappingBySchemaAction (
   tableMappings : DataTableMappingCollection,
   sourceTable : String,
   dataSetTable : String,
   mappingAction : MissingMappingAction
) : DataTableMapping;

Parameters

tableMappings
The DataTableMappingCollection to search.
sourceTable
The case-sensitive name of the SourceTable to find.
dataSetTable
The case-insensitive name of the mapped DataSetTable.
mappingAction
One of the MissingMappingAction values.

Return Value

A DataTableMapping object.

Exceptions


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

Remarks

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

If the DataTableMapping does not exist in the collection, for a given MissingMappingAction, the following happens:

MissingMappingAction Action Taken
Passthrough This method initializes a DataTableMapping with the given sourceTable as the source table name and dataSetTable as the DataSet table name. This DataTableMapping object is not added to the collection.
Error An exception is generated. The dataSetTable parameter is ignored.
Ignore Gets a null. The dataSetTable parameter is ignored.

Example

The following example demonstrates using the GetTableMappingBySchemaAction method to return a specified DataTableMapping object.

public void FindDataTableMapping ( DataAdapter myAdapter ) {
   // get table mappings
   DataTableMappingCollection myTables = myAdapter.TableMappings;
   if ( myTables.Contains ( "Employees" ) ) {
      DataTableMapping myTable = 
         DataTableMappingCollection.GetTableMappingBySchemaAction 
            ( myTables, "Employees", "", MissingMappingAction.Ignore );
   }
}
  C# VB

See Also

DataTableMappingCollection 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