datagridview总和 [英] datagridview sum

查看:87
本文介绍了datagridview总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我试图根据要求和的单元格前面的单元格求和,并将结果显示在标签中.

例如,我想对5和20求和,因为它们在它们前面是8,并在一个标签中显示总和;对10和20之和,因为在它们前面是18,并且在不同的标签中显示该总和. .
这应该在按钮单击事件上起作用.我正在从文本框中填充数据网格.


8
5
18
10
18
15
8
20

Hello everyone,

I''m trying to sum a row depending on a cell in front of the cell I want to sum and display the result in a label.

For example I would like to sum 5 and 20 because it''s 8 in front of them and display the sum in one label, and sum 10 and 20 because it''s 18 in front of them and display that sum in different label.
This should work on Button click event. I''m populating the datagrid from text boxes.


8
5
18
10
18
15
8
20

推荐答案

如果网格的数据在数据库中,那么我认为最好的选择是使用存储过程,该存储过程使用以下方法之一: SUM() [
If the data for the grid is in a database then I would think that your best bet is to use a stored procedure utilizing one of the variations of the SUM()[^] function.


这篇关于datagridview总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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