使用页脚模板,我得到了所有记录总和的总和如何将总和保存到数据库表...我在gridview中得到的总和不在数据库表... [英] using footer template the i got the sum of the totals of all records how save the sum into databse table... i m getting sum in gridview not in database table...

查看:54
本文介绍了使用页脚模板,我得到了所有记录总和的总和如何将总和保存到数据库表...我在gridview中得到的总和不在数据库表...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Columns>
    <asp:BoundField DataField="OrderNo" HeaderText="OrderNo" />
    <asp:BoundField DataField="Code" HeaderText="Code" />
    <asp:BoundField DataField="Description" HeaderText="Description" />
    <asp:BoundField DataField="Rate" HeaderText="Rate" />
    <asp:TemplateField HeaderText="Qty">
        <ItemTemplate>
            <asp:Label ID="lblqty" runat="server" Text='<%#Eval("Qty") %>' />
        </ItemTemplate>
        <FooterTemplate>
            <asp:Label ID="lbltxttotalprice" runat="server" Text="TotalPrice" />
        </FooterTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Total">
        <ItemTemplate>
            <asp:Label ID="lbltotal" runat="server" Text='<%# Eval("Total") %>' />
        </ItemTemplate>
        <FooterTemplate>
            <asp:TextBox ID="txttotalprice" runat="server" />
        </FooterTemplate>
    </asp:TemplateField>
    <asp:CommandField ShowEditButton="True" />
</Columns>

推荐答案

您需要不保存数据库中所有记录总数的总和。您可以使用 SUM [ ^ ]查询您的表格并检索总额。



示例:

You need not save the sum of total of all records in your database. You can use SUM[^] to query your table and retrieve the total.

Example:
SELECT SUM(TotalPrice) AS Total FROM yourTable


这篇关于使用页脚模板,我得到了所有记录总和的总和如何将总和保存到数据库表...我在gridview中得到的总和不在数据库表...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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