Sugerir traducción
 
Otros han sugerido:

progress indicator
No hay más sugerencias.
Evaluar y enviar comentarios
Contraer todo/Expandir todo Contraer todo
Ver contenido:  en paraleloVer contenido: en paralelo
.NET Framework Class Library
DataView Class

Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)
Visual Basic
Public Class DataView _
    Inherits MarshalByValueComponent _
    Implements IBindingListView, IBindingList, IList, ICollection,  _
    IEnumerable, ITypedList, ISupportInitializeNotification, ISupportInitialize
C#
public class DataView : MarshalByValueComponent, IBindingListView, 
    IBindingList, IList, ICollection, IEnumerable, ITypedList, 
    ISupportInitializeNotification, ISupportInitialize
Visual C++
public ref class DataView : public MarshalByValueComponent, 
    IBindingListView, IBindingList, IList, ICollection, IEnumerable, 
    ITypedList, ISupportInitializeNotification, ISupportInitialize
F#
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.

  NameDescription
Public methodSupported by the XNA FrameworkDataView()()()Initializes a new instance of the DataView class.
Public methodSupported by the XNA FrameworkDataView(DataTable)Initializes a new instance of the DataView class with the specified DataTable.
Public methodSupported by the XNA FrameworkDataView(DataTable, String, String, DataViewRowState)Initializes a new instance of the DataView class with the specified DataTable, RowFilter, Sort, and DataViewRowState.
Top
  NameDescription
Public propertySupported by the XNA FrameworkAllowDeleteSets or gets a value that indicates whether deletes are allowed.
Public propertySupported by the XNA FrameworkAllowEditGets or sets a value that indicates whether edits are allowed.
Public propertySupported by the XNA FrameworkAllowNewGets or sets a value that indicates whether the new rows can be added by using the AddNew method.
Public propertySupported by the XNA FrameworkApplyDefaultSortGets or sets a value that indicates whether to use the default sort.
Public propertySupported by the XNA FrameworkContainerGets the container for the component. (Inherited from MarshalByValueComponent.)
Public propertySupported by the XNA FrameworkCountGets the number of records in the DataView after RowFilter and RowStateFilter have been applied.
Public propertySupported by the XNA FrameworkDataViewManagerGets the DataViewManager associated with this view.
Public propertySupported by the XNA FrameworkDesignModeGets a value indicating whether the component is currently in design mode. (Inherited from MarshalByValueComponent.)
Protected propertySupported by the XNA FrameworkEventsGets the list of event handlers that are attached to this component. (Inherited from MarshalByValueComponent.)
Public propertySupported by the XNA FrameworkIsInitializedGets a value that indicates whether the component is initialized.
Protected propertySupported by the XNA FrameworkIsOpenGets a value that indicates whether the data source is currently open and projecting views of data on the DataTable.
Public propertySupported by the XNA FrameworkItemGets a row of data from a specified table.
Public propertySupported by the XNA FrameworkRowFilterGets or sets the expression used to filter which rows are viewed in the DataView.
Public propertySupported by the XNA FrameworkRowStateFilterGets or sets the row state filter used in the DataView.
Public propertySupported by the XNA FrameworkSiteGets or sets the site of the component. (Inherited from MarshalByValueComponent.)
Public propertySupported by the XNA FrameworkSortGets or sets the sort column or columns, and sort order for the DataView.
Public propertySupported by the XNA FrameworkTableGets or sets the source DataTable.
Top
  NameDescription
Public methodSupported by the XNA FrameworkAddNewAdds a new row to the DataView.
Public methodSupported by the XNA FrameworkBeginInitStarts the initialization of a DataView that is used on a form or used by another component. The initialization occurs at runtime.
Protected methodSupported by the XNA FrameworkCloseCloses the DataView.
Protected methodSupported by the XNA FrameworkColumnCollectionChangedOccurs after a DataColumnCollection has been changed successfully.
Public methodSupported by the XNA FrameworkCopyToCopies items into an array. Only for Web Forms Interfaces.
Public methodSupported by the XNA FrameworkDeleteDeletes a row at the specified index.
Public methodSupported by the XNA FrameworkDispose()()()Releases all resources used by the MarshalByValueComponent. (Inherited from MarshalByValueComponent.)
Protected methodSupported by the XNA FrameworkDispose(Boolean)Disposes of the resources (other than memory) used by the DataView object. (Overrides MarshalByValueComponent..::.Dispose(Boolean).)
Public methodSupported by the XNA FrameworkEndInitEnds the initialization of a DataView that is used on a form or used by another component. The initialization occurs at runtime.
Public methodSupported by the XNA FrameworkEquals(DataView)Determines whether the specified DataView instances are considered equal.
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from MarshalByValueComponent.)
Public methodSupported by the XNA FrameworkFind(Object)Finds a row in the DataView by the specified sort key value.
Public methodSupported by the XNA FrameworkFind(array<Object>[]()[])Finds a row in the DataView by the specified sort key values.
Public methodSupported by the XNA FrameworkFindRows(Object)Returns an array of DataRowView objects whose columns match the specified sort key value.
Public methodSupported by the XNA FrameworkFindRows(array<Object>[]()[])Returns an array of DataRowView objects whose columns match the specified sort key value.
Public methodSupported by the XNA FrameworkGetEnumeratorGets an enumerator for this DataView.
Public methodSupported by the XNA FrameworkGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetServiceGets the implementer of the IServiceProvider. (Inherited from MarshalByValueComponent.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkIndexListChangedOccurs after a DataView has been changed successfully.
Protected methodSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkOnListChangedRaises the ListChanged event.
Protected methodSupported by the XNA FrameworkOpenOpens a DataView.
Protected methodSupported by the XNA FrameworkResetReserved for internal use only.
Public methodSupported by the XNA FrameworkToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from MarshalByValueComponent.)
Public methodSupported by the XNA FrameworkToTable()()()Creates and returns a new DataTable based on rows in an existing DataView.
Public methodSupported by the XNA FrameworkToTable(String)Creates and returns a new DataTable based on rows in an existing DataView.
Public methodSupported by the XNA FrameworkToTable(Boolean, array<String>[]()[])Creates and returns a new DataTable based on rows in an existing DataView.
Public methodSupported by the XNA FrameworkToTable(String, Boolean, array<String>[]()[])Creates and returns a new DataTable based on rows in an existing DataView.
Protected methodSupported by the XNA FrameworkUpdateIndex()()()Reserved for internal use only.
Protected methodSupported by the XNA FrameworkUpdateIndex(Boolean)Reserved for internal use only.
Top
  NameDescription
Public eventSupported by the XNA FrameworkDisposedAdds an event handler to listen to the Disposed event on the component. (Inherited from MarshalByValueComponent.)
Public eventSupported by the XNA FrameworkInitializedOccurs when initialization of the DataView is completed.
Public eventSupported by the XNA FrameworkListChangedOccurs when the list managed by the DataView changes.
Top
  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodSupported by the XNA FrameworkCast<(Of <(TResult>)>)Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodSupported by the XNA FrameworkOfType<(Of <(TResult>)>)Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top
  NameDescription
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingList..::.AddIndexFor a description of this member, see IBindingList..::.AddIndex.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingList..::.AddNewFor a description of this member, see IBindingList..::.AddNew.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.AllowEditFor a description of this member, see IBindingList..::.AllowEdit.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.AllowNewFor a description of this member, see IBindingList..::.AllowNew.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.AllowRemoveFor a description of this member, see IBindingList..::.AllowRemove.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingList..::.ApplySortFor a description of this member, see IBindingList..::.ApplySort.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingList..::.FindFor a description of this member, see IBindingList..::.Find.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.IsSortedFor a description of this member, see IBindingList..::.IsSorted.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingList..::.RemoveIndexFor a description of this member, see IBindingList..::.RemoveIndex.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingList..::.RemoveSortFor a description of this member, see IBindingList..::.RemoveSort.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.SortDirectionFor a description of this member, see IBindingList..::.SortDirection.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.SortPropertyFor a description of this member, see IBindingList..::.SortProperty.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.SupportsChangeNotificationFor a description of this member, see IBindingList..::.SupportsChangeNotification.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.SupportsSearchingFor a description of this member, see IBindingList..::.SupportsSearching.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingList..::.SupportsSortingFor a description of this member, see IBindingList..::.SupportsSorting.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingListView..::.ApplySortFor a description of this member, see IBindingListView..::.ApplySort.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingListView..::.FilterFor a description of this member, see IBindingListView..::.Filter.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIBindingListView..::.RemoveFilterFor a description of this member, see IBindingListView..::.RemoveFilter.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingListView..::.SortDescriptionsFor a description of this member, see IBindingListView..::.SortDescriptions.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingListView..::.SupportsAdvancedSortingFor a description of this member, see IBindingListView..::.SupportsAdvancedSorting.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIBindingListView..::.SupportsFilteringFor a description of this member, see IBindingListView..::.SupportsFiltering.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkICollection..::.IsSynchronizedFor a description of this member, see ICollection..::.IsSynchronized.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkICollection..::.SyncRootFor a description of this member, see ICollection..::.SyncRoot.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.AddFor a description of this member, see IList..::.Add.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.ClearFor a description of this member, see IList..::.Clear.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.ContainsFor a description of this member, see IList..::.Contains.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.IndexOfFor a description of this member, see IList..::.IndexOf.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.InsertFor a description of this member, see IList..::.Insert.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIList..::.IsFixedSizeFor a description of this member, see IList..::.IsFixedSize.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIList..::.IsReadOnlyFor a description of this member, see IList..::.IsReadOnly.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIList..::.ItemFor a description of this member, see IList..::.Item.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.RemoveFor a description of this member, see IList..::.Remove.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList..::.RemoveAtFor a description of this member, see IList..::.RemoveAt.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkITypedList..::.GetItemPropertiesFor a description of this member, see ITypedList..::.GetItemProperties.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkITypedList..::.GetListNameFor a description of this member, see ITypedList..::.GetListName.
Top

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.

NoteNote

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.

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.

Visual Basic
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
C#
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:

Visual Basic
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
C#
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;

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.

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

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.

Espacio de nombres:  System.Data
Ensamblado:  System.Data (en System.Data.dll)
Visual Basic
Public Class DataView _
    Inherits MarshalByValueComponent _
    Implements IBindingListView, IBindingList, IList, ICollection,  _
    IEnumerable, ITypedList, ISupportInitializeNotification, ISupportInitialize
C#
public class DataView : MarshalByValueComponent, IBindingListView, 
    IBindingList, IList, ICollection, IEnumerable, ITypedList, 
    ISupportInitializeNotification, ISupportInitialize
Visual C++
public ref class DataView : public MarshalByValueComponent, 
    IBindingListView, IBindingList, IList, ICollection, IEnumerable, 
    ITypedList, ISupportInitializeNotification, ISupportInitialize
F#
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.

  NombreDescripción
Método públicoCompatible con XNA FrameworkDataView()()()Inicializa una nueva instancia de la clase DataView.
Método públicoCompatible con XNA FrameworkDataView(DataTable)Inicializa una nueva instancia de la clase DataView con el objeto DataTable especificado.
Método públicoCompatible con XNA FrameworkDataView(DataTable, String, String, DataViewRowState)Inicializa una nueva instancia de la clase DataView con DataTable, RowFilter, Sort y DataViewRowState especificados.
Arriba
  NombreDescripción
Propiedad públicaCompatible con XNA FrameworkAllowDeleteEstablece u obtiene un valor que indica si se permite eliminar.
Propiedad públicaCompatible con XNA FrameworkAllowEditObtiene o establece un valor que indica si se permite editar.
Propiedad públicaCompatible con XNA FrameworkAllowNewObtiene o establece un valor que indica si se pueden agregar las nuevas filas mediante el método AddNew.
Propiedad públicaCompatible con XNA FrameworkApplyDefaultSortObtiene o establece un valor que indica si se va a utilizar el orden predeterminado.
Propiedad públicaCompatible con XNA FrameworkContainerObtiene el contenedor del componente. (Se hereda de MarshalByValueComponent).
Propiedad públicaCompatible con XNA FrameworkCountObtiene el número de registros del DataView después de aplicar RowFilter y RowStateFilter.
Propiedad públicaCompatible con XNA FrameworkDataViewManagerObtiene el DataViewManager asociado a esta vista.
Propiedad públicaCompatible con XNA FrameworkDesignModeObtiene un valor que indica si el componente está actualmente en modo de diseño. (Se hereda de MarshalByValueComponent).
Propiedad protegidaCompatible con XNA FrameworkEventsObtiene la lista de controladores de eventos asociados a este componente. (Se hereda de MarshalByValueComponent).
Propiedad públicaCompatible con XNA FrameworkIsInitializedObtiene un valor que indica si el componente está inicializado.
Propiedad protegidaCompatible con XNA FrameworkIsOpenObtiene un valor que indica si el origen de datos está actualmente abierto y proyectando vistas de datos en el objeto DataTable.
Propiedad públicaCompatible con XNA FrameworkItemObtiene una fila de datos de una tabla especificada.
Propiedad públicaCompatible con XNA FrameworkRowFilterObtiene o establece la expresión utilizada para filtrar las filas que se ven en el DataView.
Propiedad públicaCompatible con XNA FrameworkRowStateFilterObtiene o establece el filtro de estado de fila utilizado en el DataView.
Propiedad públicaCompatible con XNA FrameworkSiteObtiene o establece el sitio del componente. (Se hereda de MarshalByValueComponent).
Propiedad públicaCompatible con XNA FrameworkSortObtiene o establece las columnas y el criterio de ordenación de DataView.
Propiedad públicaCompatible con XNA FrameworkTableObtiene o establece el DataTable de origen.
Arriba
  NombreDescripción
Método públicoCompatible con XNA FrameworkAddNewAgrega una nueva fila a DataView.
Método públicoCompatible con XNA FrameworkBeginInitComienza la inicialización de un objeto DataView que se emplea en un formulario o que utiliza otro componente. La inicialización se produce en tiempo de ejecución.
Método protegidoCompatible con XNA FrameworkCloseCierra DataView.
Método protegidoCompatible con XNA FrameworkColumnCollectionChangedSe produce después de cambiar correctamente un objeto DataColumnCollection.
Método públicoCompatible con XNA FrameworkCopyToCopia elementos en una matriz. Sólo para interfaces de formularios Web Forms.
Método públicoCompatible con XNA FrameworkDeleteElimina una fila en el índice especificado.
Método públicoCompatible con XNA FrameworkDispose()()()Libera todos los recursos utilizados por el objeto MarshalByValueComponent. (Se hereda de MarshalByValueComponent).
Método protegidoCompatible con XNA FrameworkDispose(Boolean)Se deshace de los recursos (distintos de la memoria) utilizados por el objeto DataView. (Invalida a MarshalByValueComponent..::.Dispose(Boolean)).
Método públicoCompatible con XNA FrameworkEndInitFinaliza la inicialización de un control DataView que se emplea en un formulario o que utiliza otro componente. La inicialización se produce en tiempo de ejecución.
Método públicoCompatible con XNA FrameworkEquals(DataView)Determina si las instancias de DataView especificadas se consideran iguales.
Método públicoCompatible con XNA FrameworkEquals(Object)Determina si el objeto Object especificado es igual al objeto Object actual. (Se hereda de Object).
Método protegidoCompatible con XNA FrameworkFinalizePermite que un objeto intente liberar recursos y realizar otras operaciones de limpieza antes de ser reclamado por la recolección de elementos no utilizados. (Se hereda de MarshalByValueComponent).
Método públicoCompatible con XNA FrameworkFind(Object)Encuentra una fila en DataView mediante el valor de criterio de ordenación especificado.
Método públicoCompatible con XNA FrameworkFind(array<Object>[]()[])Encuentra una fila en DataView mediante los valores de criterio de ordenación especificados.
Método públicoCompatible con XNA FrameworkFindRows(Object)Devuelve una matriz de objetos DataRowView cuyas columnas coinciden con el valor de criterio de ordenación especificado.
Método públicoCompatible con XNA FrameworkFindRows(array<Object>[]()[])Devuelve una matriz de objetos DataRowView cuyas columnas coinciden con el valor de criterio de ordenación especificado.
Método públicoCompatible con XNA FrameworkGetEnumeratorObtiene un enumerador para este DataView.
Método públicoCompatible con XNA FrameworkGetHashCodeActúa como función hash para un tipo concreto. (Se hereda de Object).
Método públicoCompatible con XNA FrameworkGetServiceObtiene el implementador de IServiceProvider. (Se hereda de MarshalByValueComponent).
Método públicoCompatible con XNA FrameworkGetTypeObtiene el objeto Type de la instancia actual. (Se hereda de Object).
Método protegidoCompatible con XNA FrameworkIndexListChangedSe produce después de cambiar correctamente un objeto DataView.
Método protegidoCompatible con XNA FrameworkMemberwiseCloneCrea una copia superficial del objeto Object actual. (Se hereda de Object).
Método protegidoCompatible con XNA FrameworkOnListChangedProvoca el evento ListChanged.
Método protegidoCompatible con XNA FrameworkOpenAbre un objeto DataView.
Método protegidoCompatible con XNA FrameworkResetReservado sólo para uso interno.
Método públicoCompatible con XNA FrameworkToStringDevuelve un objeto String que contiene el nombre del objeto Component, en caso de que exista. Este método no debe reemplazarse. (Se hereda de MarshalByValueComponent).
Método públicoCompatible con XNA FrameworkToTable()()()Crea y devuelve un nuevo objeto DataTable basándose en las filas de un objeto DataView existente.
Método públicoCompatible con XNA FrameworkToTable(String)Crea y devuelve un nuevo objeto DataTable basándose en las filas de un objeto DataView existente.
Método públicoCompatible con XNA FrameworkToTable(Boolean, array<String>[]()[])Crea y devuelve un nuevo objeto DataTable basándose en las filas de un objeto DataView existente.
Método públicoCompatible con XNA FrameworkToTable(String, Boolean, array<String>[]()[])Crea y devuelve un nuevo objeto DataTable basándose en las filas de un objeto DataView existente.
Método protegidoCompatible con XNA FrameworkUpdateIndex()()()Reservado sólo para uso interno.
Método protegidoCompatible con XNA FrameworkUpdateIndex(Boolean)Reservado sólo para uso interno.
Arriba
  NombreDescripción
Evento públicoCompatible con XNA FrameworkDisposedAgrega un controlador de eventos para escuchar el evento Disposed en el componente. (Se hereda de MarshalByValueComponent).
Evento públicoCompatible con XNA FrameworkInitializedSe produce cuando finaliza la inicialización de DataView.
Evento públicoCompatible con XNA FrameworkListChangedSe produce cuando la lista administrada por DataView cambia.
Arriba
  NombreDescripción
Método de extensión públicoAsParallelHabilita la paralelización de una consulta. (Definido por ParallelEnumerable).
Método de extensión públicoAsQueryableConvierte una interfaz IEnumerable en IQueryable. (Definido por Queryable).
Método de extensión públicoCompatible con XNA FrameworkCast<(Of <(TResult>)>)Convierte los elementos de IEnumerable en el tipo especificado. (Definido por Enumerable).
Método de extensión públicoCompatible con XNA FrameworkOfType<(Of <(TResult>)>)Filtra los elementos de IEnumerable en función de un tipo especificado. (Definido por Enumerable).
Arriba
  NombreDescripción
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingList..::.AddIndexPara obtener una descripción de este miembro, vea IBindingList..::.AddIndex.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingList..::.AddNewPara obtener una descripción de este miembro, vea IBindingList..::.AddNew.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.AllowEditPara obtener una descripción de este miembro, vea IBindingList..::.AllowEdit.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.AllowNewPara obtener una descripción de este miembro, vea IBindingList..::.AllowNew.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.AllowRemovePara obtener una descripción de este miembro, vea IBindingList..::.AllowRemove.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingList..::.ApplySortPara obtener una descripción de este miembro, vea IBindingList..::.ApplySort.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingList..::.FindPara obtener una descripción de este miembro, vea IBindingList..::.Find.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.IsSortedPara obtener una descripción de este miembro, vea IBindingList..::.IsSorted.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingList..::.RemoveIndexPara obtener una descripción de este miembro, vea IBindingList..::.RemoveIndex.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingList..::.RemoveSortPara obtener una descripción de este miembro, vea IBindingList..::.RemoveSort.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.SortDirectionPara obtener una descripción de este miembro, vea IBindingList..::.SortDirection.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.SortPropertyPara obtener una descripción de este miembro, vea IBindingList..::.SortProperty.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.SupportsChangeNotificationPara obtener una descripción de este miembro, vea IBindingList..::.SupportsChangeNotification.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.SupportsSearchingPara obtener una descripción de este miembro, vea IBindingList..::.SupportsSearching.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingList..::.SupportsSortingPara obtener una descripción de este miembro, vea IBindingList..::.SupportsSorting.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingListView..::.ApplySortPara obtener una descripción de este miembro, vea IBindingListView..::.ApplySort.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingListView..::.FilterPara obtener una descripción de este miembro, vea IBindingListView..::.Filter.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIBindingListView..::.RemoveFilterPara obtener una descripción de este miembro, vea IBindingListView..::.RemoveFilter.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingListView..::.SortDescriptionsPara obtener una descripción de este miembro, vea IBindingListView..::.SortDescriptions.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingListView..::.SupportsAdvancedSortingPara obtener una descripción de este miembro, vea IBindingListView..::.SupportsAdvancedSorting.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIBindingListView..::.SupportsFilteringPara obtener una descripción de este miembro, vea IBindingListView..::.SupportsFiltering.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkICollection..::.IsSynchronizedPara obtener una descripción de este miembro, vea ICollection..::.IsSynchronized.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkICollection..::.SyncRootPara obtener una descripción de este miembro, vea ICollection..::.SyncRoot.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.AddPara obtener una descripción de este miembro, vea IList..::.Add.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.ClearPara obtener una descripción de este miembro, vea IList..::.Clear.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.ContainsPara obtener una descripción de este miembro, vea IList..::.Contains.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.IndexOfPara obtener una descripción de este miembro, vea IList..::.IndexOf.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.InsertPara obtener una descripción de este miembro, vea IList..::.Insert.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIList..::.IsFixedSizePara obtener una descripción de este miembro, vea IList..::.IsFixedSize.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIList..::.IsReadOnlyPara obtener una descripción de este miembro, vea IList..::.IsReadOnly.
Implementación explícita de interfacesPropiedad privadaCompatible con XNA FrameworkIList..::.ItemPara obtener una descripción de este miembro, vea IList..::.Item.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.RemovePara obtener una descripción de este miembro, vea IList..::.Remove.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkIList..::.RemoveAtPara obtener una descripción de este miembro, vea IList..::.RemoveAt.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkITypedList..::.GetItemPropertiesPara obtener una descripción de este miembro, vea ITypedList..::.GetItemProperties.
Implementación explícita de interfacesMétodo privadoCompatible con XNA FrameworkITypedList..::.GetListNamePara obtener una descripción de este miembro, vea ITypedList..::.GetListName.
Arriba

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.

NotaNota

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.

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.

Visual Basic
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
C#
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:

Visual Basic
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
C#
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;

.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

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.

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

Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker