如何算总出货的价格

来源:百度知道 编辑:UC知道 时间:2024/07/01 06:51:01
我有如下表
Shuliang 型号 价格 名称 合计(<%=rs_tt("shuliang")*rs_tt("价格")%>)
2-----------152---200---小1---400
3-----------132---100---小2---300
合计5 ----700
进货的时候代码是
总进货<%=nowzong%>
set count_tt = server.createobject("ADODB.RecordSet")
count_tt.open sql,conn,1,3
nowzong=0
do while count_tt.eof=false
nowzong=nowzong+count_tt("shulian")*count_tt("价格")
count_tt.movenext
loop
那出货的时候如何算合计5呢??
总出货<%=nowchu%>
set count_tt = server.createobject("ADODB.RecordSet")
count_tt.open sql,conn,1,3
nowchu=0
do while count_tt.eof=false
nowchu=nowchu+count_tt("shulian")*count_tt("价格")
count_tt.movenext
loop
这样对吗?
数据库access
shuliang这个是我提问的时候打错的,代码没错,出货代码我写出来后网页上就光显示0,而进货代码没事,显示正常

QQ上帮你解决!

你没有出货价格的字段,那么出货价格和进货价格是一样的算法,你这么写是对的,不过你的写的有点错误:“count_tt("shulian")*count_tt("价格") ”应该是“count_tt("shuliang")*count_tt("价格") ”是按你的数据库字段写的。

好难哦。。。