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.

DataView提供基礎DataTable中資料的動態視圖:內容、排序和成員資格會反映發生的變更。A DataView provides a dynamic view of data in the underlying DataTable: the content, ordering, and membership reflect changes as they occur. 此行為不同于DataTableSelect方法,它會根據特定篩選和/或排序次序,從資料表傳回 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.

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 or append columns that do not exist in the source table, such as computational columns.

您可以使用 DataViewManager 來管理資料集中所有資料表的視圖設定。You can use a DataViewManager to manage view settings for all the tables in a DataSet. DataViewManager提供便利的方式來管理每個資料表的預設 view 設定。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

建立 DataView描述如何建立DataTableDataViewCreating a DataView Describes how to create a DataView for a DataTable.

排序和篩選資料描述如何設定DataView的屬性,以傳回符合特定篩選準則的資料列子集,或傳回特定排序次序的資料。Sorting and Filtering Data 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 和 datarowview描述如何存取DataView所公開的資料。DataRows and DataRowViews Describes how to access the data exposed by the DataView.

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

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

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

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

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

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

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

Dataset、datatable 和 dataview描述DataSet物件,以及您可以如何使用它來管理應用程式資料。DataSets, DataTables, and DataViews Describes the DataSet object and how you can use it to manage application data.

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

ADO.NET描述 ADO.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