DataTableMapping 构造函数

定义

初始化 DataTableMapping 类的新实例。

重载

DataTableMapping()

初始化 DataTableMapping 类的新实例。

DataTableMapping(String, String)

给定源表名称和 DataTable 名称时,使用源初始化 DataTableMapping 类的新实例。

DataTableMapping(String, String, DataColumnMapping[])

给定源表名称、DataTable 名称和 DataColumnMapping 对象数组时,初始化 DataTableMapping 类的新实例。

DataTableMapping()

Source:
DataTableMapping.cs
Source:
DataTableMapping.cs
Source:
DataTableMapping.cs

初始化 DataTableMapping 类的新实例。

public:
 DataTableMapping();
public DataTableMapping ();
Public Sub New ()

示例

以下示例创建 一个 DataTableMapping 对象。

public void CreateDataTableMapping()
{
    DataTableMapping mapping = new DataTableMapping();
    mapping.SourceTable = "Categories";
    mapping.DataSetTable = "DataCategories";
}
Public Sub CreateDataTableMapping()
    Dim mapping As New DataTableMapping()
    mapping.SourceTable = "Categories"
    mapping.DataSetTable = "DataCategories"
End Sub

另请参阅

适用于

DataTableMapping(String, String)

Source:
DataTableMapping.cs
Source:
DataTableMapping.cs
Source:
DataTableMapping.cs

给定源表名称和 DataTable 名称时,使用源初始化 DataTableMapping 类的新实例。

public:
 DataTableMapping(System::String ^ sourceTable, System::String ^ dataSetTable);
public DataTableMapping (string? sourceTable, string? dataSetTable);
public DataTableMapping (string sourceTable, string dataSetTable);
new System.Data.Common.DataTableMapping : string * string -> System.Data.Common.DataTableMapping
Public Sub New (sourceTable As String, dataSetTable As String)

参数

sourceTable
String

数据源中区分大小写的源表名称。

dataSetTable
String

DataSet 中要映射到的表名。

示例

以下示例创建 一个 DataTableMapping 对象并设置其一些属性。

public void CreateDataTableMapping()
{
    DataTableMapping mapping =
        new DataTableMapping("Categories","DataCategories");
}
Public Sub CreateDataTableMapping()
    Dim mapping As New DataTableMapping("Categories", "DataCategories")
End Sub

另请参阅

适用于

DataTableMapping(String, String, DataColumnMapping[])

Source:
DataTableMapping.cs
Source:
DataTableMapping.cs
Source:
DataTableMapping.cs

给定源表名称、DataTable 名称和 DataColumnMapping 对象数组时,初始化 DataTableMapping 类的新实例。

public:
 DataTableMapping(System::String ^ sourceTable, System::String ^ dataSetTable, cli::array <System::Data::Common::DataColumnMapping ^> ^ columnMappings);
public DataTableMapping (string? sourceTable, string? dataSetTable, System.Data.Common.DataColumnMapping[]? columnMappings);
public DataTableMapping (string sourceTable, string dataSetTable, System.Data.Common.DataColumnMapping[] columnMappings);
new System.Data.Common.DataTableMapping : string * string * System.Data.Common.DataColumnMapping[] -> System.Data.Common.DataTableMapping
Public Sub New (sourceTable As String, dataSetTable As String, columnMappings As DataColumnMapping())

参数

sourceTable
String

数据源中区分大小写的源表名称。

dataSetTable
String

DataSet 中要映射到的表名。

columnMappings
DataColumnMapping[]

一个 DataColumnMapping 对象数组。

示例

以下示例创建 一个 DataTableMapping 对象,设置其一些属性,并将其复制到 ColumnMappings 数组。 此示例假定 DataColumnMappingCollection 已创建 。

public void CreateDataTableMapping()
{
    // ...
    // create mappings
    // ...

    DataColumnMapping[] columns1 = {};
    mappings.CopyTo(columns1, 0);
    DataTableMapping mapping =
        new DataTableMapping("Categories", "DataCategories", columns1);

    DataColumnMapping[] columns2 = {};
    mapping.ColumnMappings.CopyTo(columns2, 0);
}
Public Sub CreateDataTableMapping()
    ' ...
    ' create mappings
    ' ...
    Dim columns1() As DataColumnMapping
    mappings.CopyTo(columns1, 0)
    Dim mapping As New DataTableMapping _
       ("Categories", "DataCategories", columns1)
       
    Dim columns2() As DataColumnMapping
    mapping.ColumnMappings.CopyTo(columns2, 0)
End Sub

另请参阅

适用于