Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IColumnMapping Interface
Collapse the table of content
Expand the table of content

IColumnMapping Interface

Associates a data source column with a DataSet column, and is implemented by the DataColumnMapping class, which is used in common by .NET Framework data providers.

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

[Visual Basic]
Public Interface IColumnMapping
[C#]
public interface IColumnMapping
[C++]
public __gc __interface IColumnMapping
[JScript]
public interface IColumnMapping

Classes that Implement IColumnMapping

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

Remarks

The IColumnMapping interface enables an inheriting class to implement a Column Mapping class, which associates a data source column with a DataSet column. For more information, see Setting Up DataTable and DataColumn Mappings.

An application does not create an instance of the IColumnMapping interface directly, but creates an instance of a class that inherits IColumnMapping.

Classes that inherit IColumnMapping must implement all inherited members, and typically define additional members to add provider-specific functionality. For example, the IColumnMapping interface defines the DataSetColumn property. In turn, the DataColumnMapping class inherits this property, and also defines the GetDataColumnBySchemaAction method.

Notes to Implementers:  When you inherit from the IColumnMapping interface, you should implement the following constructors:

Item Description
ColumnMapping() Initializes a new instance of the ColumnMapping class.
ColumnMapping(string sourceColumn, string dataSetColumn) Initializes a new instance of the ColumnMapping class with a source with the specified source column name and DataSet column name.

Example

[Visual Basic, C#, C++] The following example creates an instance of the derived class, DataColumnMapping, and adds it to a DataColumnMappingCollection collection. 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

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

IColumnMapping Members | System.Data Namespace

Show:
© 2015 Microsoft