LINQ系列:LINQ to DataSet的DataView操作

1. 创建DataView

EnumerableRowCollection<DataRow> expr = from p in products.AsEnumerable()
                                        orderby p.Field<int>("SortOrder")
                                        select p;
DataView view = expr.AsDataView();

2. DataView查询

EnumerableRowCollection<DataRow> expr = from p in products.AsEnumerable()
                                    where p.Field<decimal>("UnitPrice") > 10m 
                                        && p.Field<string>("ProductName").StartsWith("LINQ")
                                    select p;
DataView view = expr.AsDataView();
posted @   libingql  阅读(1263)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示