[100分]紧急求助:LinQ下使用IQueryable<T>如何将返回类型<T>使用匿名类型 问题描述如下:我有一个方法如下:public IQueryable DissensionList(Guid guid) { var p = from d in db.T_民事调解 where (d.社区Guid == guid) select new {序号=d.ID,d.纠纷甲方,d.纠纷乙方,d.调解人,d.调解时间,d.纠纷类别 }; return
1.可以使用count SELECT count(name='A' OR NULL) FROM table 2.用sum SELECT sum(if( = 'A', 1, 0)) FROM table 以上只是简单的方式,如遇到复杂的多表查询,可以结合GROUP BY,count() or sum()函数得出对应数据
public static DataTable ToDataTable<T>(this IEnumerable<T> varlist, CreateRowDelegate<T> fn) { DataTable dtReturn = new DataTable(); // column names PropertyInfo[] oProps = null; // Could add a check to verify that there is an element 0