数据视图和数据表之间的区别是什么?视图、数据表、区别、数据

2023-09-02 10:40:46 作者:崢骨野風

数据视图和数据表中的.NET之间的区别是什么? 据我了解数据视图的数据表只是一个虚假的presentation。 什么时候应该使用数据视图?

What is the difference between DataView and DataTable in .Net? As far as I understand DataView is just a false presentation of DataTable. When should I use DataView?

在此先感谢。

推荐答案

当你想运行一个查询并显示数据的控件的子集,数据视图可以帮助你。这只是一个例子,看看 MSDN示例数据视图,那说明你应该使用DataViews的与数据表...

When you want to run a query and show the subset of data in a control, a DataView could help you. That's just one example, look at the MSDN example for DataView, that explains where you should use DataViews with DataTables...

数据表

一个数据表是单个数据库表的内存重新presentation。你可以把它视为具有同样的行和列。该数据表是在ADO.NET库的核心对象。使用该DataTable中的其他对象包括数据集和数据视图。

A datatable is an in-memory representation of a single database table. You can think of it as having columns and rows in the same way. The DataTable is a central object in the ADO.NET library. Other objects that use the DataTable include the DataSet and the DataView.

看MSDN在本 DataTable类了解更多信息。

Look at MSDN The DataTable class for more details.

数据视图

一个数据视图是在数据表视图,有点像SQL视图。它可以让你过滤和排序行 - 为绑定到Windows窗体控件往往

A dataview is a view on a datatable, a bit like a sql view. It allows you to filter and sort the rows - often for binding to a windows form control.

此外,一个数据视图可以定制,以present从数据表中数据的一个子集。此功能可以让你有两个控件绑定到同一个数据表,但呈现出不同版本的数据。例如,一个控制可以结合到DataView表示所有在表中的行的,而第二也可以构成为仅显示已删除从数据表中的行。该数据表中也有一个默认视图属性,它返回的默认数据视图的表。

Additionally, a DataView can be customized to present a subset of data from the DataTable. This capability allows you to have two controls bound to the same DataTable, but showing different versions of the data. For example, one control may be bound to a DataView showing all of the rows in the table, while a second may be configured to display only the rows that have been deleted from the DataTable. The DataTable also has a DefaultView property which returns the default DataView for the table.

看MSDN DataView类了解更多详情。

Look at MSDN DataView class for more details.