如何根据表A的出货单号统计表B的总额
如图
表A(出货单,或收款单)
要统计每张出货单的总额
表B (详细出货记录表,多行出货记录合并成一张出货单)
关键是 第10行 和146 行 的代码
第10行
rs2.Open "select SUM(zonger) as zonger2 from chuhuo where chuhuodan="&str,conn2,1,1
第146行
<td height="22" align="left"><%=sumzonger(rs("chuhuodan"))%></td>
运行出错
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC 驱动程序不支持所需的属性。
/shoukuan/shoukuan.asp, 第 10 行
总代码如下:
<!--#include file="Conn2.asp"-->
<html>
<head>
<%
function sumzonger(str)
set rs2=server.CreateObject("adodb.recordset")
rs2.Open "select SUM(zonger) as zonger2 from chuhuo where chuhuodan="&str,conn2,1,1
if not rs2.eof then
sumzonger=rs2("zonger2")
else
sumzonger=""
end if
rs2.Close
set rs2=nothing
end function
function getdanwei(str)
set rs2=server.CreateObject("adodb.recordset")
rs2.Open "select danwei from chanpin where _identify="&str,conn2,1,1
if not rs2.eof then
getdanwei=rs2("danwei")
else
getdanwei=""
end if
rs2.Close
set rs2=nothing
end function
%>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" type=text/css rel=stylesheet>
<style type="text/css">
<!--
body {
background-color: #ced7f7;
}
.STYLE3 {font-size: 15px}
.STYLE5 {
font-size: 36px;
font-weight: bold;
}
-->
</style></head>
<div align="center"><span class="STYLE5">出货单</span>
</div>
<P>
<table width="562" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100" height="22" align="center"><span class="STYLE3">出货日期</span></td>
<td width="96" align="center">出货单</td>
<td width="192" height="22" align="center">单位名称</td>