DataTableMappingCollection.GetTableMappingBySchemaAction(DataTableMappingCollection, String, String, MissingMappingAction) メソッド
定義
DataColumnMapping を使用して、指定したソース テーブル名および DataSet テーブル名が含まれる MissingMappingAction オブジェクトを取得します。Gets a DataColumnMapping object with the specified source table name and DataSet table name, using the given MissingMappingAction.
public:
static System::Data::Common::DataTableMapping ^ GetTableMappingBySchemaAction(System::Data::Common::DataTableMappingCollection ^ tableMappings, System::String ^ sourceTable, System::String ^ dataSetTable, System::Data::MissingMappingAction mappingAction);
public static System.Data.Common.DataTableMapping? GetTableMappingBySchemaAction (System.Data.Common.DataTableMappingCollection? tableMappings, string sourceTable, string dataSetTable, System.Data.MissingMappingAction mappingAction);
public static System.Data.Common.DataTableMapping GetTableMappingBySchemaAction (System.Data.Common.DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, System.Data.MissingMappingAction mappingAction);
static member GetTableMappingBySchemaAction : System.Data.Common.DataTableMappingCollection * string * string * System.Data.MissingMappingAction -> System.Data.Common.DataTableMapping
Public Shared Function GetTableMappingBySchemaAction (tableMappings As DataTableMappingCollection, sourceTable As String, dataSetTable As String, mappingAction As MissingMappingAction) As DataTableMapping
パラメーター
- tableMappings
- DataTableMappingCollection
検索する DataTableMappingCollection コレクション。The DataTableMappingCollection collection to search.
- sourceTable
- String
割り当てられたソース テーブル名。大文字と小文字が区別されます。The case-sensitive name of the mapped source table.
- dataSetTable
- String
割り当てられた DataSet テーブル名。大文字と小文字は区別されません。The name, which is not case-sensitive, of the mapped DataSet table.
- mappingAction
- MissingMappingAction
MissingMappingAction 値のいずれか 1 つ。One of the MissingMappingAction values.
戻り値
DataTableMapping オブジェクト。A DataTableMapping object.
例外
mappingAction
パラメーターが Error
に設定され、マップが指定されませんでした。The mappingAction
parameter was set to Error
, and no mapping was specified.
例
次の例では、 DataTableMapping コレクション内の指定されたソーステーブル名を持つを検索します。The following example searches for a DataTableMapping with the given source table name within the collection. オブジェクトが存在する場合は、そのオブジェクトが返されます。If the object exists, it is returned. この例では、 DataTableMappingCollection コレクションと DataTableMapping オブジェクトが作成されていることを前提としています。The example assumes that a DataTableMappingCollection collection and a DataTableMapping object have been created.
public void FindDataTableMapping()
{
// ...
// create mappings and mapping
// ...
if (mappings.Contains("Categories"))
{
mapping = DataTableMappingCollection.GetTableMappingBySchemaAction
(mappings, "Categories", "", MissingMappingAction.Ignore);
}
}
Public Sub FindDataTableMapping()
' ...
' create mappings and mapping
' ...
If mappings.Contains("Categories") Then
mapping = _
DataTableMappingCollection.GetTableMappingBySchemaAction _
(mappings, "Categories", "", MissingMappingAction.Ignore)
End If
End Sub
注釈
が DataTableMapping コレクション内に存在する場合は、それが返されます。If the DataTableMapping exists in the collection, it is returned.
指定されたのコレクションにが存在しない場合、 DataTableMapping MissingMappingAction 次のようになります。If the DataTableMapping does not exist in the collection for a given MissingMappingAction, the following happens:
MissingMappingActionMissingMappingAction | 実行した操作Action taken |
---|---|
Passthrough |
指定されたをソーステーブル名として使用し、テーブル名としてオブジェクトを作成し DataTableMapping sourceTable dataSetTable DataSet ます。Creates a DataTableMapping object with the given sourceTable as the source table name and dataSetTable as the DataSet table name. 作成された DataTableMapping オブジェクトはコレクションに追加されません。The created DataTableMapping object is not added to the collection. |
Error |
例外が生成されます。An exception is generated. dataSetTable パラメーターは無視されます。The dataSetTable parameter is ignored. |
Ignore |
null を取得します。Gets null . dataSetTable パラメーターは無視されます。The dataSetTable parameter is ignored. |