Export (0) Print
Expand All

DataColumnMappingCollection Class

Contains a collection of DataColumnMapping objects.

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

System.Object
   System.MarshalByRefObject
      System.Data.Common.DataColumnMappingCollection

[Visual Basic]
NotInheritable Public Class DataColumnMappingCollection
   Inherits MarshalByRefObject
   Implements IColumnMappingCollection, IList, ICollection, _
   IEnumerable
[C#]
public sealed class DataColumnMappingCollection :
   MarshalByRefObject, IColumnMappingCollection, IList,
   ICollection,
   IEnumerable
[C++]
public __gc __sealed class DataColumnMappingCollection : public
   MarshalByRefObject, IColumnMappingCollection, IList,
   ICollection,
   IEnumerable
[JScript]
public class DataColumnMappingCollection extends MarshalByRefObject
   implements IColumnMappingCollection, IList, ICollection,
   IEnumerable

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.

Example

[Visual Basic, C#, C++] The following example uses a DataTableMapping to Add several DataColumnMapping objects to its ColumnMappings collection, and then displays a list of those mapped source columns. 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.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

DataColumnMappingCollection Members | System.Data.Common Namespace

Show:
© 2014 Microsoft