DataView Construtores

Definição

Inicializa uma nova instância da DataView classe.

Sobrecargas

Name Description
DataView()

Inicializa uma nova instância da DataView classe.

DataView(DataTable)

Inicializa uma nova instância da DataView classe com o especificado DataTable.

DataView(DataTable, String, String, DataViewRowState)

Inicializa uma nova instância da DataView classe com os especificados DataTable, RowFilter, Sort, e DataViewRowState.

DataView()

Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs

Inicializa uma nova instância da DataView classe.

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

Exemplos

O exemplo seguinte cria um novo DataView.

private void MakeDataView()
{
    DataView view = new DataView();

    view.Table = DataSet1.Tables["Suppliers"];
    view.AllowDelete = true;
    view.AllowEdit = true;
    view.AllowNew = true;
    view.RowFilter = "City = 'Berlin'";
    view.RowStateFilter = DataViewRowState.ModifiedCurrent;
    view.Sort = "CompanyName DESC";

    // Simple-bind to a TextBox control
    Text1.DataBindings.Add("Text", view, "CompanyName");
}
Private Sub MakeDataView()
    Dim view As New DataView()

    view.Table = DataSet1.Tables("Suppliers")
    view.AllowDelete = True
    view.AllowEdit = True
    view.AllowNew = True
    view.RowFilter = "City = 'Berlin'"
    view.RowStateFilter = DataViewRowState.ModifiedCurrent
    view.Sort = "CompanyName DESC"
    
    ' Simple-bind to a TextBox control
    Text1.DataBindings.Add("Text", view, "CompanyName")
End Sub

Ver também

Aplica-se a

DataView(DataTable)

Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs

Inicializa uma nova instância da DataView classe com o especificado DataTable.

public:
 DataView(System::Data::DataTable ^ table);
public DataView(System.Data.DataTable? table);
public DataView(System.Data.DataTable table);
new System.Data.DataView : System.Data.DataTable -> System.Data.DataView
Public Sub New (table As DataTable)

Parâmetros

table
DataTable

A DataTable para acrescentar ao DataView.

Exemplos

O exemplo seguinte cria um novo DataView com o especificado DataTable.

private void MakeDataView()
{
    DataView view = new DataView(DataSet1.Tables["Suppliers"]);

    // Bind a ComboBox control to the DataView.
    Combo1.DataSource = view;
    Combo1.DisplayMember = "Suppliers.CompanyName";
}
Private Sub MakeDataView()
    Dim view As DataView
    view = New DataView(DataSet1.Tables("Suppliers"))

    ' Bind a ComboBox control to the DataView.
    Combo1.DataSource = view
    Combo1.DisplayMember = "Suppliers.CompanyName"
End Sub

Ver também

Aplica-se a

DataView(DataTable, String, String, DataViewRowState)

Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs
Origem:
DataView.cs

Inicializa uma nova instância da DataView classe com os especificados DataTable, RowFilter, Sort, e DataViewRowState.

public:
 DataView(System::Data::DataTable ^ table, System::String ^ RowFilter, System::String ^ Sort, System::Data::DataViewRowState RowState);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members of types used in the filter expression might be trimmed.")]
public DataView(System.Data.DataTable table, string? RowFilter, string? Sort, System.Data.DataViewRowState RowState);
public DataView(System.Data.DataTable table, string? RowFilter, string? Sort, System.Data.DataViewRowState RowState);
public DataView(System.Data.DataTable table, string RowFilter, string Sort, System.Data.DataViewRowState RowState);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members of types used in the filter expression might be trimmed.")>]
new System.Data.DataView : System.Data.DataTable * string * string * System.Data.DataViewRowState -> System.Data.DataView
new System.Data.DataView : System.Data.DataTable * string * string * System.Data.DataViewRowState -> System.Data.DataView
Public Sub New (table As DataTable, RowFilter As String, Sort As String, RowState As DataViewRowState)

Parâmetros

table
DataTable

A DataTable para acrescentar ao DataView.

RowFilter
String

A RowFilter para aplicar ao DataView.

Sort
String

A Sort para aplicar ao DataView.

RowState
DataViewRowState

A DataViewRowState para aplicar ao DataView.

Atributos

Exemplos

O exemplo seguinte cria um novo DataView com o especificado DataTable.

private void MakeDataView(DataSet dataSet)
{
    DataView view = new DataView(dataSet.Tables["Suppliers"],
        "Country = 'UK'", "CompanyName",
        DataViewRowState.CurrentRows);
    view.AllowEdit = true;
    view.AllowNew = true;
    view.AllowDelete = true;
}
Private Sub MakeDataView(ByVal dataSet As DataSet)
    Dim view As New DataView(dataSet.Tables("Suppliers"), _
        "Country = 'UK'", "CompanyName", _
        DataViewRowState.CurrentRows)
    view.AllowEdit = True
    view.AllowNew = True
    view.AllowDelete = True
End Sub

Ver também

Aplica-se a