Redigera

Dela via


DataTableMapping.GetDataTableBySchemaAction Method

Definition

Gets the current DataTable for the specified DataSet using the specified MissingSchemaAction value.

public:
 System::Data::DataTable ^ GetDataTableBySchemaAction(System::Data::DataSet ^ dataSet, System::Data::MissingSchemaAction schemaAction);
public System.Data.DataTable? GetDataTableBySchemaAction (System.Data.DataSet dataSet, System.Data.MissingSchemaAction schemaAction);
public System.Data.DataTable GetDataTableBySchemaAction (System.Data.DataSet dataSet, System.Data.MissingSchemaAction schemaAction);
member this.GetDataTableBySchemaAction : System.Data.DataSet * System.Data.MissingSchemaAction -> System.Data.DataTable
Public Function GetDataTableBySchemaAction (dataSet As DataSet, schemaAction As MissingSchemaAction) As DataTable

Parameters

dataSet
DataSet

The DataSet from which to get the DataTable.

schemaAction
MissingSchemaAction

One of the MissingSchemaAction values.

Returns

A data table.

Examples

The following example gets the DataTable for a given DataSet. If there is no current table for the DataSet, null is returned. This example assumes that a DataSet and a DataTableMappingCollection collection have been created.

public void CreateDataTable()
{
    // ...
    // create dataSet and mapping
    // ...
    DataTable table = mapping.GetDataTableBySchemaAction
        (dataSet, MissingSchemaAction.Ignore);
}
Public Sub CreateDataTable()
    ' ...
    ' create dataSet and mapping
    ' ...
    Dim table As DataTable = mapping.GetDataTableBySchemaAction _
       (dataSet, MissingSchemaAction.Ignore)
End Sub

Remarks

If the DataTable does not exist, the specified MissingSchemaAction is taken.

Applies to

See also