DataTableMapping Class

DataTableMapping Class


Contains a description of a mapped relationship between a source table and a DataTable. This class is used by a DataAdapter when populating a DataSet.

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


public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, 


Initializes a new instance of the DataTableMapping class.

System_CAPS_pubmethodDataTableMapping(String, String)

Initializes a new instance of the DataTableMapping class with a source when given a source table name and a DataTable name.

System_CAPS_pubmethodDataTableMapping(String, String, DataColumnMapping[])

Initializes a new instance of the DataTableMapping class when given a source table name, a DataTable name, and an array of DataColumnMapping objects.


Gets or sets the table name from a DataSet.


Gets or sets the case-sensitive source table name from a data source.


Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)


Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetColumnMappingBySchemaAction(String, MissingMappingAction)

Gets a DataColumn from the specified DataTable using the specified MissingMappingAction value and the name of the DataColumn.

System_CAPS_pubmethodGetDataColumn(String, Type, DataTable, MissingMappingAction, MissingSchemaAction)

Returns a DataColumn object for a given column name.

System_CAPS_pubmethodGetDataTableBySchemaAction(DataSet, MissingSchemaAction)

Gets the current DataTable for the specified DataSet using the specified MissingSchemaAction value.


Serves as the default hash function. (Inherited from Object.)


Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)


Gets the Type of the current instance.(Inherited from Object.)


Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)


Converts the current SourceTable name to a string.(Overrides Object.ToString().)


Creates a new object that is a copy of the current instance.

A DataTableMapping provides a master mapping between the data returned from a query against a data source, and a DataTable. The DataTableMapping name can be passed in place of the DataTable name to the Fill method of the DataAdapter. For more information, see DataAdapter DataTable and DataColumn Mappings.

The following example creates a DataTableMapping object and adds it to a DataTableMappingCollection. It then informs the user that the mapping was added to the collection and displays the parent mapping.

public void AddDataTableMapping() 
    // ...
    // create tableMappings
    // ...
    DataTableMapping mapping =
        new DataTableMapping("Categories","DataCategories");
    tableMappings.Add((Object) mapping);
    Console.WriteLine("Table {0} added to {1} table mapping collection.",
        mapping.ToString(), tableMappings.ToString());

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
© 2015 Microsoft