Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

System.Object
   System.MarshalByRefObject
      System.Data.Common.DataColumnMapping

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

Remarks

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.

Example

[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

[C#] 

 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());
 }

[C++] 
void AddDataColumnMapping() {
   // ...
   // create myColumnMappings
   // ...
   DataColumnMapping* myNewMapping =
      new DataColumnMapping(S"Description",S"DataDescription");
   myColumnMappings->Add(static_cast<Object*>(myNewMapping));
   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.

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

DataColumnMapping Members | System.Data.Common Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.