查询结果总和 [英] sum of query result
本文介绍了查询结果总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
完成此操作后:
After doing this one:
SELECT TOP 10 * FROM [tablename] ORDER BY bid desc
我需要获得C#的平均值.请提供我的代码.预先感谢
I need to get the average in C#. please provide me code. Thanks in advance
推荐答案
在您的datareader迭代中,执行以下操作以计算平均值.
on your datareader iteration, do the following to compute for average.
int total = 0;
whie(dr.Read())
{
total += Convert.ToInt32(dr[0]);
}
int ave = total / 10;
问候,
爱德华
Regards,
Eduard
这篇关于查询结果总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文