.NET Framework Class Library DataView Class Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation.

Inheritance Hierarchy
Namespace:
System.Data
Assembly:
System.Data (in System.Data.dll)

Syntax
Public Class DataView _
Inherits MarshalByValueComponent _
Implements IBindingListView, IBindingList, IList, ICollection, _
IEnumerable, ITypedList, ISupportInitializeNotification, ISupportInitialize
public class DataView : MarshalByValueComponent, IBindingListView,
IBindingList, IList, ICollection, IEnumerable, ITypedList,
ISupportInitializeNotification, ISupportInitialize
public ref class DataView : public MarshalByValueComponent,
IBindingListView, IBindingList, IList, ICollection, IEnumerable,
ITypedList, ISupportInitializeNotification, ISupportInitialize
type DataView =
class
inherit MarshalByValueComponent
interface IBindingListView
interface IBindingList
interface IList
interface ICollection
interface IEnumerable
interface ITypedList
interface ISupportInitializeNotification
interface ISupportInitialize
end
The DataView type exposes the following members.

Constructors

Properties

Methods

Events

Extension Methods

Explicit Interface Implementations
|
| Name | Description |
|---|
.gif) .gif) .gif) | IBindingList..::.AddIndex | For a description of this member, see IBindingList..::.AddIndex. | .gif) .gif) .gif) | IBindingList..::.AddNew | For a description of this member, see IBindingList..::.AddNew. | .gif) .gif) .gif) | IBindingList..::.AllowEdit | For a description of this member, see IBindingList..::.AllowEdit. | .gif) .gif) .gif) | IBindingList..::.AllowNew | For a description of this member, see IBindingList..::.AllowNew. | .gif) .gif) .gif) | IBindingList..::.AllowRemove | For a description of this member, see IBindingList..::.AllowRemove. | .gif) .gif) .gif) | IBindingList..::.ApplySort | For a description of this member, see IBindingList..::.ApplySort. | .gif) .gif) .gif) | IBindingList..::.Find | For a description of this member, see IBindingList..::.Find. | .gif) .gif) .gif) | IBindingList..::.IsSorted | For a description of this member, see IBindingList..::.IsSorted. | .gif) .gif) .gif) | IBindingList..::.RemoveIndex | For a description of this member, see IBindingList..::.RemoveIndex. | .gif) .gif) .gif) | IBindingList..::.RemoveSort | For a description of this member, see IBindingList..::.RemoveSort. | .gif) .gif) .gif) | IBindingList..::.SortDirection | For a description of this member, see IBindingList..::.SortDirection. | .gif) .gif) .gif) | IBindingList..::.SortProperty | For a description of this member, see IBindingList..::.SortProperty. | .gif) .gif) .gif) | IBindingList..::.SupportsChangeNotification | For a description of this member, see IBindingList..::.SupportsChangeNotification. | .gif) .gif) .gif) | IBindingList..::.SupportsSearching | For a description of this member, see IBindingList..::.SupportsSearching. | .gif) .gif) .gif) | IBindingList..::.SupportsSorting | For a description of this member, see IBindingList..::.SupportsSorting. | .gif) .gif) .gif) | IBindingListView..::.ApplySort | For a description of this member, see IBindingListView..::.ApplySort. | .gif) .gif) .gif) | IBindingListView..::.Filter | For a description of this member, see IBindingListView..::.Filter. | .gif) .gif) .gif) | IBindingListView..::.RemoveFilter | For a description of this member, see IBindingListView..::.RemoveFilter. | .gif) .gif) .gif) | IBindingListView..::.SortDescriptions | For a description of this member, see IBindingListView..::.SortDescriptions. | .gif) .gif) .gif) | IBindingListView..::.SupportsAdvancedSorting | For a description of this member, see IBindingListView..::.SupportsAdvancedSorting. | .gif) .gif) .gif) | IBindingListView..::.SupportsFiltering | For a description of this member, see IBindingListView..::.SupportsFiltering. | .gif) .gif) .gif) | ICollection..::.IsSynchronized | For a description of this member, see ICollection..::.IsSynchronized. | .gif) .gif) .gif) | ICollection..::.SyncRoot | For a description of this member, see ICollection..::.SyncRoot. | .gif) .gif) .gif) | IList..::.Add | For a description of this member, see IList..::.Add. | .gif) .gif) .gif) | IList..::.Clear | For a description of this member, see IList..::.Clear. | .gif) .gif) .gif) | IList..::.Contains | For a description of this member, see IList..::.Contains. | .gif) .gif) .gif) | IList..::.IndexOf | For a description of this member, see IList..::.IndexOf. | .gif) .gif) .gif) | IList..::.Insert | For a description of this member, see IList..::.Insert. | .gif) .gif) .gif) | IList..::.IsFixedSize | For a description of this member, see IList..::.IsFixedSize. | .gif) .gif) .gif) | IList..::.IsReadOnly | For a description of this member, see IList..::.IsReadOnly. | .gif) .gif) .gif) | IList..::.Item | For a description of this member, see IList..::.Item. | .gif) .gif) .gif) | IList..::.Remove | For a description of this member, see IList..::.Remove. | .gif) .gif) .gif) | IList..::.RemoveAt | For a description of this member, see IList..::.RemoveAt. | .gif) .gif) .gif) | ITypedList..::.GetItemProperties | For a description of this member, see ITypedList..::.GetItemProperties. | .gif) .gif) .gif) | ITypedList..::.GetListName | For a description of this member, see ITypedList..::.GetListName. | Top

Remarks
A major function of the DataView is to allow for data binding on both Windows Forms and Web Forms. Additionally, a DataView can be customized to present a subset of data from the DataTable. This capability lets you have two controls bound to the same DataTable, but that show different versions of the data. For example, one control might be bound to a DataView that shows all the rows in the table, and a second might be configured to display only the rows that have been deleted from the DataTable. The DataTable also has a DefaultView property. This returns the default DataView for the table. For example, if you want to create a custom view on the table, set the RowFilter on the DataView returned by the DefaultView. To create a filtered and sorted view of data, set the RowFilter and Sort properties. Then, use the Item property to return a single DataRowView. You can also add and delete from the set of rows using the AddNew and Delete methods. When you use those methods, the RowStateFilter property can set to specify that only deleted rows or new rows be displayed by the DataView. Note |
|---|
If you do not explicitly specify sort criteria for DataView, the DataRowView objects in DataView are sorted based on the index of DataView's corresponding DataRow in the DataTable.Rows DataRowCollection. |
LINQ to DataSet allows developers to create complex, powerful queries over a DataSet by using LINQ. A LINQ to DataSet query returns an enumeration of DataRow objects, however, which is not easily used in a binding scenario. DataView can be created from a LINQ to DataSet query and takes on the filtering and sorting characteristics of that query. LINQ to DataSet extends the functionality of the DataView by providing LINQ expression-based filtering and sorting, which allows for much more complex and powerful filtering and sorting operations than string-based filtering and sorting. See Data Binding and LINQ to DataSet for more information.

Examples
The following example creates a single DataTable with one column and five rows. Two DataView objects are created and the RowStateFilter is set on each to show different views of the table data. The values are then printed.
Private Sub DemonstrateDataView()
' Create one DataTable with one column.
Dim table As DataTable = New DataTable("table")
Dim colItem As DataColumn = New DataColumn("item", _
Type.GetType("System.String"))
table.Columns.Add(colItem)
' Add five items.
Dim NewRow As DataRow
Dim i As Integer
For i = 0 To 4
NewRow = table.NewRow()
NewRow("item") = "Item " & i
table.Rows.Add(NewRow)
Next
table.AcceptChanges()
' Create two DataView objects with the same table.
Dim firstView As DataView = New DataView(table)
Dim secondView As DataView = New DataView(table)
' Change the values in the table.
table.Rows(0)("item") = "cat"
table.Rows(1)("item") = "dog"
' Print current table values.
PrintTableOrView(table, "Current Values in Table")
' Set first DataView to show only modified versions of original rows.
firstView.RowStateFilter = DataViewRowState.ModifiedOriginal
' Print values.
PrintTableOrView(firstView, "First DataView: ModifiedOriginal")
' Add one New row to the second view.
Dim rowView As DataRowView
rowView = secondView.AddNew()
rowView("item") = "fish"
' Set second DataView to show modified versions of
' current rows, or New rows.
secondView.RowStateFilter = DataViewRowState.ModifiedCurrent _
Or DataViewRowState.Added
' Print modified and Added rows.
PrintTableOrView(secondView, _
"Second DataView: ModifiedCurrent or Added")
End Sub
Overloads Private Sub PrintTableOrView( _
ByVal view As DataView, ByVal label As String)
Console.WriteLine(label)
Dim i As Integer
For i = 0 To view.count - 1
Console.WriteLine(view(i)("item"))
Next
Console.WriteLine()
End Sub
Overloads Private Sub PrintTableOrView( _
ByVal table As DataTable, ByVal label As String)
Console.WriteLine(label)
Dim i As Integer
For i = 0 To table.Rows.Count - 1
Console.WriteLine(table.Rows(i)("item"))
Next
Console.WriteLine()
End Sub
private void DemonstrateDataView()
{
// Create one DataTable with one column.
DataTable table = new DataTable("table");
DataColumn colItem = new DataColumn("item",
Type.GetType("System.String"));
table.Columns.Add(colItem);
// Add five items.
DataRow NewRow;
for(int i = 0; i <5; i++)
{
NewRow = table.NewRow();
NewRow["item"] = "Item " + i;
table.Rows.Add(NewRow);
}
// Change the values in the table.
table.Rows[0]["item"]="cat";
table.Rows[1]["item"] = "dog";
table.AcceptChanges();
// Create two DataView objects with the same table.
DataView firstView = new DataView(table);
DataView secondView = new DataView(table);
// Print current table values.
PrintTableOrView(table,"Current Values in Table");
// Set first DataView to show only modified
// versions of original rows.
firstView.RowStateFilter=DataViewRowState.ModifiedOriginal;
// Print values.
PrintTableOrView(firstView,"First DataView: ModifiedOriginal");
// Add one New row to the second view.
DataRowView rowView;
rowView=secondView.AddNew();
rowView["item"] = "fish";
// Set second DataView to show modified versions of
// current rows, or New rows.
secondView.RowStateFilter=DataViewRowState.ModifiedCurrent
| DataViewRowState.Added;
// Print modified and Added rows.
PrintTableOrView(secondView,
"Second DataView: ModifiedCurrent | Added");
}
private void PrintTableOrView(DataTable table, string label)
{
// This function prints values in the table or DataView.
Console.WriteLine("\n" + label);
for(int i = 0; i<table.Rows.Count;i++)
{
Console.WriteLine("\table" + table.Rows[i]["item"]);
}
Console.WriteLine();
}
private void PrintTableOrView(DataView view, string label)
{
// This overload prints values in the table or DataView.
Console.WriteLine("\n" + label);
for(int i = 0; i<view.Count;i++)
{
Console.WriteLine("\table" + view[i]["item"]);
}
Console.WriteLine();
}
The following example creates a DataView of online orders ordered by total due from a LINQ to DataSet query:
Dim orders As DataTable = dataSet.Tables("SalesOrderHeader")
Dim query = _
From order In orders.AsEnumerable() _
Where order.Field(Of Boolean)("OnlineOrderFlag") = True _
Order By order.Field(Of Decimal)("TotalDue") _
Select order
Dim view As DataView = query.AsDataView()
bindingSource1.DataSource = view
DataTable orders = dataSet.Tables["SalesOrderHeader"];
EnumerableRowCollection<DataRow> query =
from order in orders.AsEnumerable()
where order.Field<bool>("OnlineOrderFlag") == true
orderby order.Field<decimal>("TotalDue")
select order;
DataView view = query.AsDataView();
bindingSource1.DataSource = view;

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
This type is safe for multithreaded read operations. You must synchronize any write operations.

See Also
|
Biblioteca de clases de .NET Framework DataView (Clase) Representa una vista personalizada que puede enlazar datos de un DataTable para ordenación, filtrado, búsqueda, edición y navegación.

Jerarquía de herencia
Espacio de nombres:
System.Data
Ensamblado:
System.Data (en System.Data.dll)

Sintaxis
Public Class DataView _
Inherits MarshalByValueComponent _
Implements IBindingListView, IBindingList, IList, ICollection, _
IEnumerable, ITypedList, ISupportInitializeNotification, ISupportInitialize
public class DataView : MarshalByValueComponent, IBindingListView,
IBindingList, IList, ICollection, IEnumerable, ITypedList,
ISupportInitializeNotification, ISupportInitialize
public ref class DataView : public MarshalByValueComponent,
IBindingListView, IBindingList, IList, ICollection, IEnumerable,
ITypedList, ISupportInitializeNotification, ISupportInitialize
type DataView =
class
inherit MarshalByValueComponent
interface IBindingListView
interface IBindingList
interface IList
interface ICollection
interface IEnumerable
interface ITypedList
interface ISupportInitializeNotification
interface ISupportInitialize
end
El tipo DataView expone los siguientes miembros.

Constructores

Métodos

Eventos

Métodos de extensión

Implementaciones explícitas de interfaces
|
| Nombre | Descripción |
|---|
.gif) .gif) .gif) | IBindingList..::.AddIndex | Para obtener una descripción de este miembro, vea IBindingList..::.AddIndex. | .gif) .gif) .gif) | IBindingList..::.AddNew | Para obtener una descripción de este miembro, vea IBindingList..::.AddNew. | .gif) .gif) .gif) | IBindingList..::.AllowEdit | Para obtener una descripción de este miembro, vea IBindingList..::.AllowEdit. | .gif) .gif) .gif) | IBindingList..::.AllowNew | Para obtener una descripción de este miembro, vea IBindingList..::.AllowNew. | .gif) .gif) .gif) | IBindingList..::.AllowRemove | Para obtener una descripción de este miembro, vea IBindingList..::.AllowRemove. | .gif) .gif) .gif) | IBindingList..::.ApplySort | Para obtener una descripción de este miembro, vea IBindingList..::.ApplySort. | .gif) .gif) .gif) | IBindingList..::.Find | Para obtener una descripción de este miembro, vea IBindingList..::.Find. | .gif) .gif) .gif) | IBindingList..::.IsSorted | Para obtener una descripción de este miembro, vea IBindingList..::.IsSorted. | .gif) .gif) .gif) | IBindingList..::.RemoveIndex | Para obtener una descripción de este miembro, vea IBindingList..::.RemoveIndex. | .gif) .gif) .gif) | IBindingList..::.RemoveSort | Para obtener una descripción de este miembro, vea IBindingList..::.RemoveSort. | .gif) .gif) .gif) | IBindingList..::.SortDirection | Para obtener una descripción de este miembro, vea IBindingList..::.SortDirection. | .gif) .gif) .gif) | IBindingList..::.SortProperty | Para obtener una descripción de este miembro, vea IBindingList..::.SortProperty. | .gif) .gif) .gif) | IBindingList..::.SupportsChangeNotification | Para obtener una descripción de este miembro, vea IBindingList..::.SupportsChangeNotification. | .gif) .gif) .gif) | IBindingList..::.SupportsSearching | Para obtener una descripción de este miembro, vea IBindingList..::.SupportsSearching. | .gif) .gif) .gif) | IBindingList..::.SupportsSorting | Para obtener una descripción de este miembro, vea IBindingList..::.SupportsSorting. | .gif) .gif) .gif) | IBindingListView..::.ApplySort | Para obtener una descripción de este miembro, vea IBindingListView..::.ApplySort. | .gif) .gif) .gif) | IBindingListView..::.Filter | Para obtener una descripción de este miembro, vea IBindingListView..::.Filter. | .gif) .gif) .gif) | IBindingListView..::.RemoveFilter | Para obtener una descripción de este miembro, vea IBindingListView..::.RemoveFilter. | .gif) .gif) .gif) | IBindingListView..::.SortDescriptions | Para obtener una descripción de este miembro, vea IBindingListView..::.SortDescriptions. | .gif) .gif) .gif) | IBindingListView..::.SupportsAdvancedSorting | Para obtener una descripción de este miembro, vea IBindingListView..::.SupportsAdvancedSorting. | .gif) .gif) .gif) | IBindingListView..::.SupportsFiltering | Para obtener una descripción de este miembro, vea IBindingListView..::.SupportsFiltering. | .gif) .gif) .gif) | ICollection..::.IsSynchronized | Para obtener una descripción de este miembro, vea ICollection..::.IsSynchronized. | .gif) .gif) .gif) | ICollection..::.SyncRoot | Para obtener una descripción de este miembro, vea ICollection..::.SyncRoot. | .gif) .gif) .gif) | IList..::.Add | Para obtener una descripción de este miembro, vea IList..::.Add. | .gif) .gif) .gif) | IList..::.Clear | Para obtener una descripción de este miembro, vea IList..::.Clear. | .gif) .gif) .gif) | IList..::.Contains | Para obtener una descripción de este miembro, vea IList..::.Contains. | .gif) .gif) .gif) | IList..::.IndexOf | Para obtener una descripción de este miembro, vea IList..::.IndexOf. | .gif) .gif) .gif) | IList..::.Insert | Para obtener una descripción de este miembro, vea IList..::.Insert. | .gif) .gif) .gif) | IList..::.IsFixedSize | Para obtener una descripción de este miembro, vea IList..::.IsFixedSize. | .gif) .gif) .gif) | IList..::.IsReadOnly | Para obtener una descripción de este miembro, vea IList..::.IsReadOnly. | .gif) .gif) .gif) | IList..::.Item | Para obtener una descripción de este miembro, vea IList..::.Item. | .gif) .gif) .gif) | IList..::.Remove | Para obtener una descripción de este miembro, vea IList..::.Remove. | .gif) .gif) .gif) | IList..::.RemoveAt | Para obtener una descripción de este miembro, vea IList..::.RemoveAt. | .gif) .gif) .gif) | ITypedList..::.GetItemProperties | Para obtener una descripción de este miembro, vea ITypedList..::.GetItemProperties. | .gif) .gif) .gif) | ITypedList..::.GetListName | Para obtener una descripción de este miembro, vea ITypedList..::.GetListName. | Arriba

Comentarios
Una función fundamental de DataView es permitir el enlace de datos con formularios Windows Forms y Web Forms. Además, un DataView se puede personalizar para presentar un subconjunto de datos de DataTable. Esta capacidad permite tener dos controles enlazados al mismo objeto DataTable y que muestren versiones distintas de los datos. Por ejemplo, un control puede estar enlazado a un objeto DataView que muestre todas las filas de la tabla y el segundo puede estar configurado para mostrar sólo las filas que se hayan eliminado de DataTable. La clase DataTable también tiene una propiedad DefaultView. Esta propiedad devuelve el objeto DataView predeterminado para la tabla. Por ejemplo, si desea crear una vista personalizada en la tabla, establezca la propiedad RowFilter en el objeto DataView que devuelve la propiedad DefaultView. Para crear una vista filtrada y ordenada de datos, establezca las propiedades RowFilter y Sort. A continuación, utilice la propiedad Item para devolver un único DataRowView. También se pueden agregar y eliminar del conjunto de filas mediante los métodos AddNew y Delete. Cuando se utilizan estos métodos, la propiedad RowStateFilter se puede establecer para que especifique que DataView sólo muestre las filas eliminadas o nuevas. Nota |
|---|
Si no se especifican explícitamente los criterios de ordenación para DataView, los objetos DataRowView de DataView se ordenan de acuerdo con el índice del objeto DataRow correspondiente de DataView en DataTable.Rows DataRowCollection. |
LINQ to DataSet permite a los programadores crear consultas complejas y eficaces en DataSet utilizando LINQ. Una consulta LINQ to DataSet devuelve una enumeración de objetos DataRow que, sin embargo, no se utiliza con facilidad en un escenario de enlace. DataView se puede crear de una consulta LINQ to DataSet y toma el filtrado y las características de ordenación de esa consulta. LINQ to DataSet extiende la funcionalidad de DataView proporcionando ordenación y filtrado basados en expresiones de LINQ, lo que permite operaciones de ordenación y filtrado mucho más eficaces y complejas que las basadas en cadenas. Para obtener más información, vea Enlace de datos y LINQ to DataSet.

Ejemplos
En el ejemplo siguiente se crea un único DataTable con una columna y cinco filas. Se crean dos objetos DataView y el RowStateFilter se establece en cada uno para mostrar distintas vistas de los datos de la tabla. A continuación, se imprimen los valores.
Private Sub DemonstrateDataView()
' Create one DataTable with one column.
Dim table As DataTable = New DataTable("table")
Dim colItem As DataColumn = New DataColumn("item", _
Type.GetType("System.String"))
table.Columns.Add(colItem)
' Add five items.
Dim NewRow As DataRow
Dim i As Integer
For i = 0 To 4
NewRow = table.NewRow()
NewRow("item") = "Item " & i
table.Rows.Add(NewRow)
Next
table.AcceptChanges()
' Create two DataView objects with the same table.
Dim firstView As DataView = New DataView(table)
Dim secondView As DataView = New DataView(table)
' Change the values in the table.
table.Rows(0)("item") = "cat"
table.Rows(1)("item") = "dog"
' Print current table values.
PrintTableOrView(table, "Current Values in Table")
' Set first DataView to show only modified versions of original rows.
firstView.RowStateFilter = DataViewRowState.ModifiedOriginal
' Print values.
PrintTableOrView(firstView, "First DataView: ModifiedOriginal")
' Add one New row to the second view.
Dim rowView As DataRowView
rowView = secondView.AddNew()
rowView("item") = "fish"
' Set second DataView to show modified versions of
' current rows, or New rows.
secondView.RowStateFilter = DataViewRowState.ModifiedCurrent _
Or DataViewRowState.Added
' Print modified and Added rows.
PrintTableOrView(secondView, _
"Second DataView: ModifiedCurrent or Added")
End Sub
Overloads Private Sub PrintTableOrView( _
ByVal view As DataView, ByVal label As String)
Console.WriteLine(label)
Dim i As Integer
For i = 0 To view.count - 1
Console.WriteLine(view(i)("item"))
Next
Console.WriteLine()
End Sub
Overloads Private Sub PrintTableOrView( _
ByVal table As DataTable, ByVal label As String)
Console.WriteLine(label)
Dim i As Integer
For i = 0 To table.Rows.Count - 1
Console.WriteLine(table.Rows(i)("item"))
Next
Console.WriteLine()
End Sub
private void DemonstrateDataView()
{
// Create one DataTable with one column.
DataTable table = new DataTable("table");
DataColumn colItem = new DataColumn("item",
Type.GetType("System.String"));
table.Columns.Add(colItem);
// Add five items.
DataRow NewRow;
for(int i = 0; i <5; i++)
{
NewRow = table.NewRow();
NewRow["item"] = "Item " + i;
table.Rows.Add(NewRow);
}
// Change the values in the table.
table.Rows[0]["item"]="cat";
table.Rows[1]["item"] = "dog";
table.AcceptChanges();
// Create two DataView objects with the same table.
DataView firstView = new DataView(table);
DataView secondView = new DataView(table);
// Print current table values.
PrintTableOrView(table,"Current Values in Table");
// Set first DataView to show only modified
// versions of original rows.
firstView.RowStateFilter=DataViewRowState.ModifiedOriginal;
// Print values.
PrintTableOrView(firstView,"First DataView: ModifiedOriginal");
// Add one New row to the second view.
DataRowView rowView;
rowView=secondView.AddNew();
rowView["item"] = "fish";
// Set second DataView to show modified versions of
// current rows, or New rows.
secondView.RowStateFilter=DataViewRowState.ModifiedCurrent
| DataViewRowState.Added;
// Print modified and Added rows.
PrintTableOrView(secondView,
"Second DataView: ModifiedCurrent | Added");
}
private void PrintTableOrView(DataTable table, string label)
{
// This function prints values in the table or DataView.
Console.WriteLine("\n" + label);
for(int i = 0; i<table.Rows.Count;i++)
{
Console.WriteLine("\table" + table.Rows[i]["item"]);
}
Console.WriteLine();
}
private void PrintTableOrView(DataView view, string label)
{
// This overload prints values in the table or DataView.
Console.WriteLine("\n" + label);
for(int i = 0; i<view.Count;i++)
{
Console.WriteLine("\table" + view[i]["item"]);
}
Console.WriteLine();
}
En el ejemplo siguiente se crea un objeto DataView de órdenes en línea ordenadas por totales total a partir de una consulta LINQ to DataSet:
Dim orders As DataTable = dataSet.Tables("SalesOrderHeader")
Dim query = _
From order In orders.AsEnumerable() _
Where order.Field(Of Boolean)("OnlineOrderFlag") = True _
Order By order.Field(Of Decimal)("TotalDue") _
Select order
Dim view As DataView = query.AsDataView()
bindingSource1.DataSource = view
DataTable orders = dataSet.Tables["SalesOrderHeader"];
EnumerableRowCollection<DataRow> query =
from order in orders.AsEnumerable()
where order.Field<bool>("OnlineOrderFlag") == true
orderby order.Field<decimal>("TotalDue")
select order;
DataView view = query.AsDataView();
bindingSource1.DataSource = view;

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Seguridad para subprocesos
Este tipo es seguro para operaciones de lectura multiproceso. Debe sincronizar cualquier operación de escritura.

Vea también
|