日期:2014-05-17  浏览次数:21076 次

求和问题,有真假值吗
<%
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open "select * from kehu ",conn,1,1

 
hj_Jz_price=0
hj_sk_price=0

if not rs.eof then

 do while not rs.eof  

%>
  <tr bgcolor="#EAE8E3" onmouseover="this.bgColor='#f6f6f6';" onmouseout="this.bgColor='#EAE8E3';">
  <td height="15" >&nbsp;<a href="kh_xx.asp?id=<%=rs("id")%>"><span class="STYLE4"><%=rs("kh_name")%>
  </span></a></td>
  <td ><a href="kh_xx.asp?id=<%=rs("sk_kh")%>">&nbsp;
  <span class="STYLE4">
  <%
  set rs1=server.CreateObject ("adodb.recordset")
sql="select sum(price) as Jz_price from Jizhang where kh="&rs("id")
rs1.open sql,conn,1,1
if not rs1.eof then
response.write rs1("Jz_price")
hj_Jz_price=hj_Jz_price+rs1("Jz_price")
else
response.write"0"
end if
%>
  </span></a></td>
  <td >&nbsp;
<%
  set rs2=server.CreateObject ("adodb.recordset")
sql="select sum(sk_num) as sk_price from shoukuan where sk_kh="&rs("id")
rs2.open sql,conn,1,1

response.write rs2("sk_price")
hj_sk_price=hj_sk_price+rs2("sk_price")
 
%> </td>
  <td>&nbsp;<%=rs1("jz_price")-rs2("sk_price")%></td>
  <td>&nbsp;<%=rs("kh_memo")%> </td>
  </tr>
<%

rs.movenext
loop
rs.close
rs1.close
rs2.close
set rs=nothing
set rs1=nothing
set rs2=nothing

else
response.write"<tr> <td height=27 colspan=10>目前记录信息</td> </tr>"
end if

%>
  <tr bgcolor="#CCCCCC" >
  <td height="30" ><strong>统合统计:</strong></td>
  <td><strong>&nbsp;<%=hj_Jz_price%></strong></td>
  <td><strong>&nbsp;<%=hj_sk_price%></strong></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>



------解决方案--------------------
你把数据转换成数值型计算 或者 看看你的数据库是不是有为空的
------解决方案--------------------
没有对应着你怎么统计啊?