首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

求和有关问题,有真假值吗

2012-03-18 
求和问题,有真假值吗%Set rs Server.CreateObject(ADODB.Recordset)rs.open select * from kehu ,co

求和问题,有真假值吗
<%
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>



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

热点排行
Bad Request.