DataViewDataViews

DataView 允許您為儲存在 DataTable 內的資料建立不同的檢視,這是資料繫結應用程式中常用的功能。A DataView enables you to create different views of the data stored in a DataTable, a capability that is often used in data-binding applications. 使用DataView可以公開資料表以不同排序順序中的資料,您可以依資料列狀態或根據篩選條件運算式來篩選資料。Using a DataView, you can expose the data in a table with different sort orders, and you can filter the data by row state or based on a filter expression.

A DataView提供動態檢視的資料在基礎DataTable: 內容、 順序和成員資格反映的變更發生時。A DataView provides a dynamic view of data in the underlying DataTable: the content, ordering, and membership reflect changes as they occur. 此行為不同於選取 方法DataTable,以傳回DataRow特定的篩選和/或排序順序為基礎的資料表中的陣列: 這個內容反映變更基礎資料表,但其成員資格和順序仍維持靜態。This behavior differs from the Select method of the DataTable, which returns a DataRow array from a table based on a particular filter and/or sort order: this content reflects changes to the underlying table, but its membership and ordering remain static. 動態功能DataView適合用來資料繫結的應用程式。The dynamic capabilities of the DataView make it ideal for data-binding applications.

A DataView您提供一組資料,很像資料庫檢視,您可以套用不同的排序和篩選準則的動態檢視。A DataView provides you with a dynamic view of a single set of data, much like a database view, to which you can apply different sorting and filtering criteria. 與資料庫檢視,不過,不同DataView無法被視為資料表,而無法提供聯結資料表的檢視。Unlike a database view, however, a DataView cannot be treated as a table and cannot provide a view of joined tables. 此外,您也不能排除來源資料表中的資料行,也不能附加來源資料表中不存在的資料行 (如計算資料行)。You also cannot exclude columns that exist in the source table, nor can you append columns, such as computational columns, that do not exist in the source table.

您可以使用DataViewManager管理中的所有資料表的檢視設定資料集You can use a DataViewManager to manage view settings for all the tables in a DataSet. DataViewManager提供便利的方式來管理每個資料表的預設檢視設定。The DataViewManager provides you with a convenient way to manage default view settings for each table. 將控制項繫結至多個資料表時資料集繫結至DataViewManager是理想的選擇。When binding a control to more than one table of a DataSet, binding to a DataViewManager is the ideal choice.

本節內容In This Section

建立 DataViewCreating a DataView
描述如何建立DataView for DataTableDescribes how to create a DataView for a DataTable.

排序和篩選資料Sorting and Filtering Data
描述如何設定的屬性DataView符合特定篩選準則,傳回的資料列的子集,或以特定的排序順序傳回資料。Describes how to set the properties of a DataView to return subsets of data rows meeting specific filter criteria, or to return data in a particular sort order.

DataRow 和 DataRowViewDataRows and DataRowViews
描述如何存取所公開的資料DataViewDescribes how to access the data exposed by the DataView.

尋找資料列Finding Rows
描述如何尋找特定資料列DataViewDescribes how to find a particular row in a DataView.

子檢視和關聯ChildViews and Relations
描述如何建立從父子式關聯性使用的資料檢視DataViewDescribes how to create views of data from a parent-child relationship using a DataView.

修改 DataViewModifying DataViews
描述如何修改的資料在基礎DataTable透過DataView,包括啟用或停用更新。Describes how to modify the data in the underlying DataTable via the DataView, including enabling or disabling updates.

處理 DataView 事件Handling DataView Events
描述如何使用ListChanged事件,以接收通知時的內容或順序DataView正在更新。Describes how to use the ListChanged event to receive notification when the contents or order of a DataView is being updated.

管理 DataViewManaging DataViews
描述如何使用DataViewManager來管理DataView設定中每個資料表資料集Describes how to use a DataViewManager to manage DataView settings for each table in a DataSet.

ASP.NET Web 應用程式ASP.NET Web Applications
提供 ASP.NET 應用程式、Web Form 和 Web 服務的建立概觀和詳細的步驟程序。Provides overviews and detailed, step-by-step procedures for creating ASP.NET applications, Web Forms, and Web Services.

Windows 應用程式Windows Applications
提供有關使用 Windows Form 和主控台應用程式的詳細資訊。Provides detailed information about working with Windows Forms and console applications.

DataSet、DataTable 和 DataViewDataSets, DataTables, and DataViews
描述資料集物件及如何使用它來管理應用程式資料。Describes the DataSet object and how you can use it to manage application data.

DataTableDataTables
描述DataTable物件,以及如何使用它來管理應用程式資料本身,或做為一部分DataSetDescribes the DataTable object and how you can use it to manage application data by itself or as part of a DataSet.

ADO.NETADO.NET
說明 ADO.NET 的架構和元件,以及如何使用 ADO.NET 來存取現有資料來源和管理應用程式資料。Describes the ADO.NET architecture and components, and how to use ADO.NET to access existing data sources and manage application data.

另請參閱See also