Export (0) Print
Expand All

DataTableMappingCollection Class

A collection of DataTableMapping objects. This class cannot be inherited.

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

System.Object
   System.MarshalByRefObject
      System.Data.Common.DataTableMappingCollection

[Visual Basic]
NotInheritable Public Class DataTableMappingCollection
   Inherits MarshalByRefObject
   Implements ITableMappingCollection, IList, ICollection, _
   IEnumerable
[C#]
public sealed class DataTableMappingCollection :
   MarshalByRefObject, ITableMappingCollection, IList, ICollection,
   IEnumerable
[C++]
public __gc __sealed class DataTableMappingCollection : public
   MarshalByRefObject, ITableMappingCollection, IList, ICollection,
   IEnumerable
[JScript]
public class DataTableMappingCollection extends MarshalByRefObject
   implements ITableMappingCollection, 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 an OleDbDataAdapter to Add DataTableMapping objects to its TableMappings collection, and then displays a list of those mapped source tables. This example assumes that an OleDbDataAdapter has already been created.

[Visual Basic] 
Public Sub ShowTableMappings()
    ' ...
    ' create myDataAdapter
    ' ...
    myDataAdapter.TableMappings.Add("Categories", "DataCategories")
    myDataAdapter.TableMappings.Add("Orders", "DataOrders")
    myDataAdapter.TableMappings.Add("Products", "DataProducts")
    Dim myMessage As String = "Table Mappings:" + ControlChars.Cr
    Dim i As Integer
    For i = 0 To myDataAdapter.TableMappings.Count - 1
        myMessage += i.ToString() + " " _
           + myDataAdapter.TableMappings(i).ToString() + ControlChars.Cr
    Next i
    MessageBox.Show(myMessage)
End Sub

[C#] 
public void ShowTableMappings() {
   // ...
   // create myDataAdapter
   // ...
   myDataAdapter.TableMappings.Add("Categories","DataCategories");
   myDataAdapter.TableMappings.Add("Orders","DataOrders");
   myDataAdapter.TableMappings.Add("Products","DataProducts");
   string myMessage = "Table Mappings:\n";
   for(int i=0;i < myDataAdapter.TableMappings.Count;i++) {
      myMessage += i.ToString() + " "
         + myDataAdapter.TableMappings[i].ToString() + "\n";
   }
   MessageBox.Show(myMessage);
}

[C++] 
void ShowTableMappings() {
   // ...
   // create myDataAdapter
   // ...
   myDataAdapter->TableMappings->Add(S"Categories",S"DataCategories");
   myDataAdapter->TableMappings->Add(S"Orders",S"DataOrders");
   myDataAdapter->TableMappings->Add(S"Products",S"DataProducts");
   String* myMessage = S"Table Mappings:\n";
   for(int i=0;i < myDataAdapter->TableMappings->Count;i++) {
       myMessage = String::Concat( myMessage, __box(i)->ToString(), S" ",
         myDataAdapter->TableMappings->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

DataTableMappingCollection Members | System.Data.Common Namespace

Show:
© 2014 Microsoft