How to set round of the result of aggregate function used in dynamic linq query?
问题 Below is my code: sFieldList.Select(y => "Sum(Convert.ToDouble(iif(it[\""+y+"\"] == @0,0,it[\""+y+"\"]))) as "+y)and then var newSort = dataTable .AsEnumerable() .AsQueryable() .GroupBy("new("+gField+")", "it") .Select("new("+sField+",it.Key as Key, it as Data)",DBNull.Value); I wish to round of the result of Sum() method above to 2 decimal digits. How can I add it in this query itself? 回答1: Hopefully I'm understanding your problem correctly, but as far as I can tell, you just need an