Export (0) Print
Expand All

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.

For a list of all members of this type, see DataTableMapping Members.

System.Object
   System.MarshalByRefObject
      System.Data.Common.DataTableMapping

[Visual Basic]
NotInheritable Public Class DataTableMapping
   Inherits MarshalByRefObject
   Implements ITableMapping, ICloneable
[C#]
public sealed class DataTableMapping : MarshalByRefObject,
   ITableMapping, ICloneable
[C++]
public __gc __sealed class DataTableMapping : public
   MarshalByRefObject, ITableMapping, ICloneable
[JScript]
public class DataTableMapping extends MarshalByRefObject implements
   ITableMapping, ICloneable

Thread Safety

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

Remarks

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 Setting Up DataTable and DataColumn Mappings.

Example

[Visual Basic, C#, C++] 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.

[Visual Basic] 
Public Sub AddDataTableMapping()
    ' ...
    ' create myTableMappings
    ' ...
    Dim myNewMapping As New DataTableMapping("Categories", "DataCategories")
    myTableMappings.Add(CType(myNewMapping, Object))
    MessageBox.Show("Table " + myNewMapping.ToString() + " added to " _
       + "table mapping collection " + myTableMappings.ToString())
End Sub

[C#] 
public void AddDataTableMapping() {
   // ...
   // create myTableMappings
   // ...
   DataTableMapping myNewMapping =
      new DataTableMapping("Categories","DataCategories");
   myTableMappings.Add((Object) myNewMapping);
   MessageBox.Show("Table " + myNewMapping.ToString() + " added to " +
      "table mapping collection " + myTableMappings.ToString());
}

[C++] 
void AddDataTableMapping() {
   // ...
   // create myTableMappings
   // ...
   DataTableMapping* myNewMapping =
      new DataTableMapping(S"Categories",S"DataCategories");
   myTableMappings->Add(static_cast<Object*>(myNewMapping));
   MessageBox::Show(String::Concat( S"Table ", myNewMapping->ToString(), S" added to ",
      S"table mapping collection ", myTableMappings->ToString() ));
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Data.Common

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

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

See Also

DataTableMapping Members | System.Data.Common Namespace

Show:
© 2014 Microsoft