我想要做的是在最後一行中得到總和。這裏有2組itens與總和的例子:SumTotal在每組結束時經典asp
我:
1000 (group number)
TitleUm TitleTres TitleQuatro
Apple 1 20
Pear 5 12
1001 (group number)
TV 1 20
Mobile 1 12
Car 1 15
Bicycle 1 5
TOTAL 10 84
我要找:
1000 (group number)
TitleUm TitleTres TitleQuatro
Apple 1 20
Pear 5 12
TOTAL 6 32
1001 (group number)
TV 1 20
Mobile 1 12
Car 1 15
Bicycle 1 5
TOTAL 4 52
代碼波紋管做幾乎所有的東西,列出項目,每行每一個值,但它現在展示的總和:
<table class="Itens">
<%
currentGroupName = ""
previousGroupName = ""
Do Until ItensList.EOF
currentGroupName = ItensList("oito")
Um= ItensList("um")
Tres= ItensList("tres")
Quatro= CCur(ItensList("quatro"))
If currentGroupName <> previousGroupName Then
%>
<tr>
<td><% Response.Write currentGroupName %></td>
</tr>
<tr>
<th><% Response.Write TituloUm %></th>
<th><% Response.Write TituloTres %></th>
<th><% Response.Write TituloQuatro %></th>
</tr>
<%
End If
%>
<%
Um= CCur(ItensList("um"))
Tres= CCur(ItensList("tres"))
Quatro= CCur(ItensList("quatro"))
%>
<tr>
<td><% Response.Write Um %></td>
<td><% Response.Write Tres %></td>
<td><% Response.Write Quatro %></td>
</tr>
<%
previousGroupName = currentGroupName
ItensList.MoveNext
Loop
ItensList.Close
%>
<tr class="Total">
<td>TOTAL</td>
<td><% Response.Write ShowSumTotalTresHere %></td>
<td><% Response.Write ShowSumTotalQuatroHere %></td>
</tr>
</table>
感謝您的幫助
謝謝,但原始代碼僅在組列表的末尾添加總行數,而不是在每個組中添加總行數(1 000 ... 1001 ...) – Khrys