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 @ 2014-10-23 15:51 libingql 阅读(...) 评论(...) 编辑 收藏