如何将数据库列的多个值相加 [英] how to sum multiple value of a database column

查看:317
本文介绍了如何将数据库列的多个值相加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在php中,有一个代码可以使用以下代码访问数据库列的所有值:





while($ rows = mysql_fetch_array($ qry_result)

{

//想做什么

}



但我怎么能在c#中做...请帮助。提前谢谢

In php there is a code to access all value of a database column by using the following code:


while($rows=mysql_fetch_array($qry_result)
{
// what to want to do
}

but how can I do it in c#.. please help. thanks in advance

推荐答案

rows = mysql_fetch_array(
rows=mysql_fetch_array(


qry_result)

{

//想做什么

}



但我怎样才能在c#中做..请帮助。提前感谢
qry_result)
{
// what to want to do
}

but how can I do it in c#.. please help. thanks in advance


参考:使用DataReader检索数据 [ ^ ]

如果你想要sql中数字列的总和,请参考:<小时ef =http://www.w3schools.com/sql/sql_func_sum.asp> sql_func_sum [ ^ ]
Refer: Retrieving Data Using a DataReader[^]
If you want the sum of a numeric column in sql, refer: sql_func_sum[^]


这篇关于如何将数据库列的多个值相加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆