本文介绍了如何在datagridview中添加特定列的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友
我有一个datagridview从数据库检索信息.我的数据库有一个表,该表有一个称为收入的列,现在我想要的是一种在每天结束时对收入列的值进行求和的方法,以获取当天的总收入.请提前对此表示感谢.
Hi friends
i have a datagridview that retreive information from a db. My db has a table that has a column called income, now what i want is a way to sum up the value of the income column at the end of everyday to get the total income for that day. Please i need help on this thanks in advance
推荐答案
<asp:Repeater> <!-- Get unique days -->
<ItemTemplate>
<asp:GridView> <!-- Bind the data based on the day -->
</ItemTemplate>
</asp:Repeater>
put a textbox in the footer control then find the textbox control using
textbox txtSum= gridview1.FooterRow.FindControl("txtTotal") as TextBox
Then bind the total value to txtSum like how you will bind data to grid
txtSum= "select sum(income) from incometable"
这篇关于如何在datagridview中添加特定列的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!