DataTableMappingCollection.GetTableMappingBySchemaAction Méthode

Définition

Obtient un DataColumnMapping objet avec le nom de la table source et DataSet le nom de table spécifiés, à l’aide du nom donné MissingMappingAction.

public:
 static System::Data::Common::DataTableMapping ^ GetTableMappingBySchemaAction(System::Data::Common::DataTableMappingCollection ^ tableMappings, System::String ^ sourceTable, System::String ^ dataSetTable, System::Data::MissingMappingAction mappingAction);
public static System.Data.Common.DataTableMapping GetTableMappingBySchemaAction(System.Data.Common.DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, System.Data.MissingMappingAction mappingAction);
static member GetTableMappingBySchemaAction : System.Data.Common.DataTableMappingCollection * string * string * System.Data.MissingMappingAction -> System.Data.Common.DataTableMapping
Public Shared Function GetTableMappingBySchemaAction (tableMappings As DataTableMappingCollection, sourceTable As String, dataSetTable As String, mappingAction As MissingMappingAction) As DataTableMapping

Paramètres

tableMappings
DataTableMappingCollection

Collection DataTableMappingCollection à rechercher.

sourceTable
String

Nom sensible à la casse de la table source mappée.

dataSetTable
String

Nom, qui n’est pas sensible à la casse, de la table mappée DataSet .

mappingAction
MissingMappingAction

Une des MissingMappingAction valeurs.

Retours

Objet DataTableMapping.

Exceptions

Le mappingAction paramètre a été défini Errorsur , et aucun mappage n’a été spécifié.

Exemples

L’exemple suivant recherche un DataTableMapping nom de table source donné dans la collection. Si l’objet existe, il est retourné. L’exemple suppose qu’une DataTableMappingCollection collection et un DataTableMapping objet ont été créés.

public void FindDataTableMapping()
{
    // ...
    // create mappings and mapping
    // ...
    if (mappings.Contains("Categories"))
    {
        mapping = DataTableMappingCollection.GetTableMappingBySchemaAction
            (mappings, "Categories", "", MissingMappingAction.Ignore);
    }
}
Public Sub FindDataTableMapping()
    ' ...
    ' create mappings and mapping
    ' ...
    If mappings.Contains("Categories") Then
        mapping = _
           DataTableMappingCollection.GetTableMappingBySchemaAction _
           (mappings, "Categories", "", MissingMappingAction.Ignore)
    End If
End Sub

Remarques

S’il DataTableMapping existe dans la collection, il est retourné.

DataTableMapping S’il n’existe pas dans la collection pour une donnéeMissingMappingAction, ce qui suit se produit :

MissingMappingAction Action exécutée
Passthrough Crée un DataTableMapping objet avec le sourceTable nom de la table source et dataSetTable le nom de la DataSet table. L’objet créé DataTableMapping n’est pas ajouté à la collection.
Error Une exception est générée. Le paramètre dataSetTable est ignoré.
Ignore Obtient null. Le paramètre dataSetTable est ignoré.

S’applique à