自己看看ms的帮助吧dv仅仅是dt的一个视图,dv中有一些属性dt没有,比如rowfilter,但是dt也能够通过其他方法简单的得到。还有比如排序等。 customized view of a DataTable for sorting, filtering, searching, editing, and navigationAdditionally, 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. For example, if you wish 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.我觉得主要是应用方便性的一个区别,上述的是我认为最常见的菜鸟来抛砖头了。赫赫
DataTable dt = new DataTable(); DataView dv = new DataView();//u can do DataRow[] dr = dt.Select("myname = arli");// u can't do DataRow[] dr = dv.Select("myname = arli");
就象数据库中的表和视图一样。
这就是区别。
customized view of a DataTable for sorting, filtering, searching, editing, and navigationAdditionally, 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. For example, if you wish 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.我觉得主要是应用方便性的一个区别,上述的是我认为最常见的菜鸟来抛砖头了。赫赫
http://www.csdn.net/develop/Read_Article.asp?Id=17840
DataView dv = new DataView();//u can do
DataRow[] dr = dt.Select("myname = arli");// u can't do
DataRow[] dr = dv.Select("myname = arli");
DataView数据视图,能迅速的对用户要求的数据进行检索
我想可以用DataView的RowFilter来做到吧
如 dv.RowFilter("myname=arli")
给分,结贴! :)