Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DataTableMapping Constructor

DataTableMapping Constructor

.NET Framework 1.1

Initializes a new instance of the DataTableMapping class.

Overload List

Initializes a new instance of the DataTableMapping class.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New()
[C#] public DataTableMapping();
[C++] public: DataTableMapping();
[JScript] public function DataTableMapping();

Initializes a new instance of the DataTableMapping class with a source when given a source table name and a DataTable name.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(String, String)
[C#] public DataTableMapping(string, string);
[C++] public: DataTableMapping(String*, String*);
[JScript] public function DataTableMapping(String, String);

Initializes a new instance of the DataTableMapping class when given a source table name, a DataTable name, and an array of DataColumnMapping objects.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(String, String, DataColumnMapping())
[C#] public DataTableMapping(string, string, DataColumnMapping[]);
[C++] public: DataTableMapping(String*, String*, DataColumnMapping[]);
[JScript] public function DataTableMapping(String, String, DataColumnMapping[]);

Example

[Visual Basic, C#, C++] The following example creates a DataTableMapping object, sets some of its properties, and copies its ColumnMappings to an array. This example assumes that a DataColumnMappingCollection has been created.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of the DataTableMapping constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Sub CreateDataTableMapping()
    ' ...
    ' create myColumnMappings
    ' ...
    Dim myNewColumnArray1() As DataColumnMapping
    myColumnMappings.CopyTo(myNewColumnArray1, 0)
    Dim myNewMapping As New DataTableMapping _
       ("Categories", "DataCategories", myNewColumnArray1)
       
    Dim myNewColumnArray2() As DataColumnMapping
    myNewMapping.ColumnMappings.CopyTo(myNewColumnArray2, 0)
End Sub

[C#] 
public void CreateDataTableMapping() {
   // ...
   // create myColumnMappings
   // ...
   
   DataColumnMapping[] myNewColumnArray1 = {};
   myColumnMappings.CopyTo(myNewColumnArray1, 0);
   DataTableMapping myNewMapping =
      new DataTableMapping("Categories", "DataCategories", myNewColumnArray1);
   
   DataColumnMapping[] myNewColumnArray2 = {};
   myNewMapping.ColumnMappings.CopyTo(myNewColumnArray2, 0);
}

[C++] 
void CreateDataTableMapping() {
   // ...
   // create myColumnMappings
   // ...
   
   DataColumnMapping* myNewColumnArray1[] = new DataColumnMapping*[0];
   myColumnMappings->CopyTo(myNewColumnArray1, 0);
   DataTableMapping* myNewMapping =
      new DataTableMapping(S"Categories", S"DataCategories", myNewColumnArray1);
   
   DataColumnMapping* myNewColumnArray2[] = new DataColumnMapping*[0];
   myNewMapping->ColumnMappings->CopyTo(myNewColumnArray2, 0);
}

[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.

See Also

DataTableMapping Class | DataTableMapping Members | System.Data.Common Namespace

Show:
© 2015 Microsoft