select报错

       query = query.Where(c => c.MfcKey==temp);
                    int hhho = query.Count();
                    query = from q in query
                            join par in pf.GetList() on q.ArtID equals par.ArtID
                            orderby par.ATime descending
                            select par;

关于这个SELECT

因为select筛选前对QUEry赋值并给定义了实体类,所以在select后我不能给她定义匿名类,定义的类型应与筛选的实体类相同,

如果要定义匿名类的话,正确写法如下:

       query = query.Where(c => c.MfcKey==temp);
                    int hhho = query.Count();
                  var  ry = from q in query
                            join par in pf.GetList() on q.ArtID equals par.ArtID
                            orderby par.ATime descending
                            select new{
q.ArtID



};

  推荐一篇好文https://www.cnblogs.com/liujie2272/p/6732461.html   

posted @ 2018-07-27 10:50  水上浮萍cc  阅读(296)  评论(0编辑  收藏  举报