add a new DataColumn and set its Expression to "AVG(YourColumn)" or "StDev(YourColumn)"DataTable.Columns.Add("NewColumn",typeof(Decimal),"AVG(YourColumn)");then
Decimal d = (Decimal)DataTable.Rows[0]["NewColumn"];
other aggregates:
Sum (Sum)
Avg (Average)
Min (Minimum)
Max (Maximum)
Count (Count)
StDev (Statistical standard deviation)
Var (Statistical variance)
Decimal d = (Decimal)DataTable.Rows[0]["NewColumn"];
other aggregates:
Sum (Sum)
Avg (Average)
Min (Minimum)
Max (Maximum)
Count (Count)
StDev (Statistical standard deviation)
Var (Statistical variance)
解决方案 »
- .net 如何实现创建JPG图片
- vs2010 web项目 停止调试后asp.net development serve怎么自动关闭了
- 文件上传问题!! 最大能调多大?这样好吗?有别的办法吗??
- 怎么才能定义checkbox的CSS啊?
- 变量接收到读取数据库值,如何显示出来啊。
- 关于VB.net 做 ASPX的一些问题
- 求助,尊敬的程序员们,如何把别人回复的(有一定格式)内容保存到数据库中并且从新调出来时不变(在ASP.NET程序中)
- C#中命名空间中 System.Drawing问题
- 在一个类中如何得到文件路径?
- vb.net编译问题!各位请进!
- 高分,解决立即给分!
- 对于自定义的datagrid分页,如何实现排序功能?
DS.Tables["ClassScore"].Columns.Add("NewColumn",typeof(Decimal),"AVG(DS.Tables['ClassScore'].Columns['Score'])" );//错误
Decimal d=(Decimal)DS.Tables["ClassScore"].Rows[0]["NewColumn"];
Response.Write(d);报错:System.Data.SyntaxErrorException: 聚合参数中的语法错误:需要具有可能的“Child”限定符的单个列参数。
能再帮我看看吗?谢谢!