28,391
社区成员
发帖
与我相关
我的任务
分享
<%'select 出入库表.名称,出入库表.时间,出入库表.数量,出入库表.类型,库存表.库存 from 出入库表 left join 库存表.名称=出入库表.名称 where 名称='1'
'取上面这个sql语句的游标到rs中
id=1
totalout=0
totalin=0
kucun=0
%>
<table border="1">
<tr><td>ID</td><td>名称</td><td>时间</td><td>入库</td><td>出库</td><td>结存</td></tr>
<%
while not rs.eof
kucun=rs(4)
%>
<tr><td>ID</td><td><%=rs(0) %></td><td><%=rs(1) %></td><td>
<%
if rs(3)="入库" then
response.write rs(2)
totalin=totalin+rs(2)
else
response.write "null"
end if
%>
</td><td>
<%
if rs(3)="入库" then
response.write "null"
else
response.write rs(2)
totalout=totalout+rs(2)'''''''这里用错变量
end if
%>
</td><td><%=rs(2) %></td></tr>
<%
id=id+1
wend
%>
<tr><td colspan="3">合计</td><td><%=totalin %></td><td><%=totalout %></td><td><%=totalout %></td></tr>
</table>
<%'select 出入库表.名称,出入库表.时间,出入库表.数量,出入库表.类型,库存表.库存 from 出入库表 left join 库存表.名称=出入库表.名称 where 名称='1'
'取上面这个sql语句的游标到rs中
id=1
totalout=0
totalin=0
kucun=0
%>
<table border="1">
<tr><td>ID</td><td>名称</td><td>时间</td><td>入库</td><td>出库</td><td>结存</td></tr>
<%
while not rs.eof
kucun=rs(4)
%>
<tr><td>ID</td><td><%=rs(0) %></td><td><%=rs(1) %></td><td>
<%
if rs(3)="入库" then
response.write rs(2)
totalin=totalin+rs(2)
else
response.write "null"
end if
%>
</td><td>
<%
if rs(3)="入库" then
response.write "null"
else
response.write rs(2)
totalout=totalin+rs(2)
end if
%>
</td><td><%=rs(2) %></td></tr>
<%
id=id+1
wend
%>
<tr><td colspan="3">合计</td><td><%=totalin %></td><td><%=totalout %></td><td><%=totalout %></td></tr></table>