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

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
[C#]
public interface IColumnMappingCollection : IList, ICollection,
   IEnumerable
[C++]
public __gc __interface IColumnMappingCollection : public IList,
   ICollection, IEnumerable
[JScript]
public interface IColumnMappingCollection implements IList,
   ICollection, IEnumerable

Classes that Implement IColumnMappingCollection

Class Description
DataColumnMappingCollection Contains a collection of DataColumnMapping objects.

Remarks

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.

Example

[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
    MessageBox.Show(myMessage)
End Sub

[C#] 

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

[C++] 
void ShowColumnMappings() {
// ...
// create myTableMap
// ...
myTableMap->ColumnMappings->Add(S"Category Name",S"DataCategory");
myTableMap->ColumnMappings->Add(S"Description",S"DataDescription");
myTableMap->ColumnMappings->Add(S"Picture",S"DataPicture");
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" );
}
MessageBox::Show(myMessage);
 }

[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

IColumnMappingCollection Members | System.Data Namespace

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