This documentation is archived and is not being maintained.

DataColumnMapping Class

Contains a generic column mapping for an object that inherits from DataAdapter. This class cannot be inherited.

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


[Visual Basic]
NotInheritable Public Class DataColumnMapping
   Inherits MarshalByRefObject
   Implements IColumnMapping, ICloneable
public sealed class DataColumnMapping : MarshalByRefObject,
   IColumnMapping, ICloneable
public __gc __sealed class DataColumnMapping : public
   MarshalByRefObject, IColumnMapping, ICloneable
public class DataColumnMapping extends MarshalByRefObject
   implements IColumnMapping, 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.


A DataColumnMapping enables you to use column names in a DataTable that are different from those in the data source. The DataAdapter uses the mapping to match the columns when the tables in the DataSet or data source are updated. For more information, see Setting Up DataTable and DataColumn Mappings.


[Visual Basic, C#, C++] The following example creates a DataColumnMapping object and adds it to a DataColumnMappingCollection. It then tells the user that the mapping was added to the collection and shows the Parent for the mapping.

[Visual Basic] 
Public Sub AddDataColumnMapping()
    ' ...
    ' create myColumnMappings
    ' ...
    Dim myNewMapping As New DataColumnMapping("Description", "DataDescription")
    myColumnMappings.Add(CType(myNewMapping, Object))
    MessageBox.Show("column " + myNewMapping.ToString() + " added to " _
       + "column mapping collection " + myColumnMappings.ToString())
End Sub


 public void AddDataColumnMapping() {
    // ...
    // create myColumnMappings
    // ...
    DataColumnMapping myNewMapping =
       new DataColumnMapping("Description","DataDescription");
    myColumnMappings.Add((Object) myNewMapping);
    MessageBox.Show("column " + myNewMapping.ToString() + " added to " +
       "column mapping collection " + myColumnMappings.ToString());

void AddDataColumnMapping() {
   // ...
   // create myColumnMappings
   // ...
   DataColumnMapping* myNewMapping =
      new DataColumnMapping(S"Description",S"DataDescription");
   MessageBox::Show(String::Concat( S"column ", myNewMapping->ToString(), S" added to ",
      S"column mapping collection ", myColumnMappings->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.


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

DataColumnMapping Members | System.Data.Common Namespace