Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataTableMappingCollection.GetTableMappingBySchemaAction Method

Gets a DataColumnMapping object with the specified source table name and DataSet table name, using the given MissingMappingAction.

Namespace: System.Data.Common
Assembly: System.Data (in system.data.dll)

public static DataTableMapping GetTableMappingBySchemaAction (
	DataTableMappingCollection tableMappings,
	string sourceTable,
	string dataSetTable,
	MissingMappingAction mappingAction
)
public static DataTableMapping GetTableMappingBySchemaAction (
	DataTableMappingCollection tableMappings, 
	String sourceTable, 
	String dataSetTable, 
	MissingMappingAction mappingAction
)
public static function GetTableMappingBySchemaAction (
	tableMappings : DataTableMappingCollection, 
	sourceTable : String, 
	dataSetTable : String, 
	mappingAction : MissingMappingAction
) : DataTableMapping

Parameters

tableMappings

The DataTableMappingCollection collection to search.

sourceTable

The case-sensitive name of the mapped source table.

dataSetTable

The name, which is not case-sensitive, of the mapped DataSet table.

mappingAction

One of the MissingMappingAction values.

Return Value

A DataTableMapping object.

Exception typeCondition

InvalidOperationException

The mappingAction parameter was set to Error, and no mapping was specified.

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

Creates a DataTableMapping object with the given sourceTable as the source table name and dataSetTable as the DataSet table name. The created DataTableMapping object is not added to the collection.

Error

An exception is generated. The dataSetTable parameter is ignored.

Ignore

Gets a null reference (Nothing in Visual Basic). The dataSetTable parameter is ignored.

The following example searches for a DataTableMapping with the given source table name within the collection. If the object exists, it is returned. The example assumes that a DataTableMappingCollection collection and a DataTableMapping object have been created.

public void FindDataTableMapping() 
{
    // ...
    // create mappings and mapping
    // ...
    if (mappings.Contains("Categories")) 
    {
        mapping = DataTableMappingCollection.GetTableMappingBySchemaAction
            (mappings, "Categories", "", MissingMappingAction.Ignore);
    


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft