高手帮我看看累加的问题

情绝书生 2004-04-01 07:16:54
为什么我下面sum_1和sum_3的值取不到



<%@LANGUAGE="VBSCRIPT"%>
<%
codeline = request("codeline")
inttime = request("inttime")
endtime = request("endtime")
if codeline<>"" and inttime<>"" and endtime<>"" then
set rs=server.createobject("adodb.recordset")
sqltext="select * from linemanage where deadline between #"&inttime&"# And #"&endtime&"# and codeline='"&codeline&"' order by id desc"
rs.open sqltext,conn,1,1
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from linemanage where deadline between #"&inttime&"# And #"&endtime&"# order by id desc"
rs.open sqltext,conn,1,1
end if
dim MaxPerPage
MaxPerPage=20

'假如没有数据时
If rs.eof and rs.bof then
call showpages
response.write "<p align='center'><font color='#ff0000'>还没任何相关记录</font></p>"
response.end
End if

'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

call showpages
call list

If Rs.recordcount > MaxPerPage then
call showpages
end if

'显示帖子的子程序
Sub list()
%>
<center>
<table width="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="text" type="text" id="text" size="20" class="smallInput">
: <br>
<br>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="unnamed1" height="20">
<td width="18%" height="32" align="center" class="unnamed1">线厂</td>
<td width="10%" height="32" align="center" class="unnamed1">线号</td>
<td width="13%" height="32" align="center" class="unnamed1">缸号</td>
<td width="15%" height="32" align="center" class="unnamed1">实际进线数量</td>
<td width="8%" height="32" align="center" class="unnamed1">单价</td>
<td width="9%" height="32" align="center" class="unnamed1">货款</td>
<td height="32" align="center" class="unnamed1">备注</td>
</tr>
<%
i=0
do while not rs.eof
sum_1 = sum_1 + ccur(rs("thequantity"))
sum_2 = rs("thequantity")*rs("price")
sum_3 = sum_3 + sum_2
%>
<tr valign="middle">
<td width="18%" height="32" align="center" class="tableBorder"><%=rs("codeline")%> </td>
<td width="10%" height="32" align="center" class="tableBorder"><%=rs("linenumber")%> </td>
<td height="32" align="center" class="tableBorder"><%=rs("jarnumber")%> </td>
<td width="15%" height="32" align="center" class="tableBorder"><%=rs("thequantity")%> </td>
<td width="8%" height="32" align="center" class="tableBorder"><%=rs("price")%> </td>
<td width="9%" height="32" align="center" class="tableBorder"><%=sum_2%></td>
<td height="32" align="center" class="tableBorder"> </td>
</tr>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
end sub
%>
<tr align="right" valign="middle">
<td height="32" colspan="7" class="tableBorder">  实际进线数量为:<%=sum_1%>      货款为:<%=sum_3%>元    </td>
</tr>
</table></td>
</tr>
</table>
<%
'显示翻页的子程序
sub showpages()
%>
<table border="0" cellPadding="0" cellSpacing="0" width="760" height="20" align="center">
<tr>
<td width="100%" align="right"> <font color="#000000">
<%
Response.write "<a href='linemanagesearch.asp?page="+Cstr(currentPage-1)+"&codeline="&codeline&"&inttime="&inttime&"&endtime="&endtime&"'><font color='#000000'>-</font></a>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font> "
Response.write "<a href='linemanagesearch.asp?page="+Cstr(currentPage+1)+"&codeline="&codeline&"&inttime="&inttime&"&endtime="&endtime&"'><font color='#000000'>-</font></a>"
%>
</font> </td>
</tr>
</table>
<%end sub%>
</center>
<%
rs.close
conn.close
%>
</body>
</html>
...全文
25 点赞 收藏 2
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
cjf1009 2004-04-01
rs("thequantity")和rs("price")都是什么类型的?
回复
vvfish119 2004-04-01
do while not rs.eof
sum_1 = sum_1 + ccur(rs("thequantity"))
sum_2 = rs("thequantity")*rs("price")
sum_3 = sum_3 + sum_2
%>
<tr valign="middle">
<td width="18%" height="32" align="center" class="tableBorder"><%=rs("codeline")%> </td>
<td width="10%" height="32" align="center" class="tableBorder"><%=rs("linenumber")%> </td>
<td height="32" align="center" class="tableBorder"><%=rs("jarnumber")%> </td>
<td width="15%" height="32" align="center" class="tableBorder"><%=rs("thequantity")%> </td>
<td width="8%" height="32" align="center" class="tableBorder"><%=rs("price")%> </td>
<td width="9%" height="32" align="center" class="tableBorder"><%=sum_2%></td>
<td height="32" align="center" class="tableBorder"> </td>
</tr>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
改成


for i=0 to MaxPerpage
sum_1 = sum_1 + ccur(rs("thequantity"))
sum_2 = rs("thequantity")*rs("price")
sum_3 = sum_3 + sum_2
%>
<tr valign="middle">
<td width="18%" height="32" align="center" class="tableBorder"><%=rs("codeline")%> </td>
<td width="10%" height="32" align="center" class="tableBorder"><%=rs("linenumber")%> </td>
<td height="32" align="center" class="tableBorder"><%=rs("jarnumber")%> </td>
<td width="15%" height="32" align="center" class="tableBorder"><%=rs("thequantity")%> </td>
<td width="8%" height="32" align="center" class="tableBorder"><%=rs("price")%> </td>
<td width="9%" height="32" align="center" class="tableBorder"><%=sum_2%></td>
<td height="32" align="center" class="tableBorder"> </td>
</tr>
<%if rs.eof then exit for
rs.movenext
next
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告