This documentation is archived and is not being maintained.

IColumnMappingCollection Interface

Contains a collection of DataColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET Framework data providers.

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

[Visual Basic]
Public Interface IColumnMappingCollection
   Inherits IList, ICollection, IEnumerable
public interface IColumnMappingCollection : IList, ICollection,
public __gc __interface IColumnMappingCollection : public IList,
   ICollection, IEnumerable
public interface IColumnMappingCollection implements IList,
   ICollection, IEnumerable

Classes that Implement IColumnMappingCollection

Class Description
DataColumnMappingCollection Contains a collection of DataColumnMapping objects.


The IColumnMappingCollection interface enables an inheriting class to implement a ColumnMapping collection. For more information, see Setting Up DataTable and DataColumn Mappings.

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

Classes that inherit IColumnMappingCollection must implement all inherited members, and typically define additional members to add provider-specific functionality. For example, the IColumnMappingCollection interface defines the RemoveAt method. In turn, the DataTableMappingCollection class inherits this method, and defines two additional overloads of RemoveAt.

Notes to Implementers:  When you inherit from the IColumnMappingCollection interface, you should implement the following constructor:

Item Description
ColumnMappingCollection() Creates an empty ColumnMappingCollection class.


[Visual Basic, C#, C++] The following example uses an instance of the derived class, DataTableMapping, to Add several DataColumnMapping objects to its ColumnMappings collection, and then displays a list of those mapped source tables. This example assumes that a DataTableMapping has already been created.

[Visual Basic] 
Public Sub ShowColumnMappings()
    ' ...
    ' create myTableMap
    ' ...
    myTableMap.ColumnMappings.Add("Category Name", "DataCategory")
    myTableMap.ColumnMappings.Add("Description", "DataDescription")
    myTableMap.ColumnMappings.Add("Picture", "DataPicture")
    Dim myMessage As String = "Column Mappings:" + ControlChars.Cr
    Dim i As Integer
    For i = 0 To myTableMap.ColumnMappings.Count - 1
        myMessage += i.ToString() + " " _
           + myTableMap.ColumnMappings(i).ToString() + ControlChars.Cr
    Next i
End Sub


 public void ShowColumnMappings() {
    // ...
    // create myTableMap
    // ...
    myTableMap.ColumnMappings.Add("Category Name","DataCategory");
    string myMessage = "Column Mappings:\n";
    for(int i=0;i < myTableMap.ColumnMappings.Count;i++) {
       myMessage += i.ToString() + " "
          + myTableMap.ColumnMappings[i].ToString() + "\n";

void ShowColumnMappings() {
// ...
// create myTableMap
// ...
myTableMap->ColumnMappings->Add(S"Category Name",S"DataCategory");
String* myMessage = S"Column Mappings:\n";
for(int i=0;i < myTableMap->ColumnMappings->Count;i++) {
    myMessage = String::Concat( myMessage, __box(i)->ToString(), S" ", myTableMap->ColumnMappings->Item[i]->ToString(), S"\n" );

[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

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

IColumnMappingCollection Members | System.Data Namespace