| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 555 人关注过本帖
标题:关于空值问题
只看楼主 加入收藏
xtyby
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-4-1
收藏
 问题点数:0 回复次数:6 
关于空值问题

<!--#include file="XTG.asp"-->
<%
exec="select distinct goodsid,goods.memorycode from c_gccs,goods where c_gccs.goodsid = goods.goodsid and c_gccs.billdate >='2007-01-01' and c_gccs.billdate <='2007-01-25' order by goods.barcode"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>规格及型号</title>
<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>
<meta name="Microsoft Theme" content="expeditn 011, default">
</head>
<body background="_themes/expeditn/exptextb.jpg" bgcolor="#FFFFFF" text="#000000" link="#993300" vlink="#666600" alink="#CC3300"><!--mstheme--><font face="宋体">
<div align="center">
<center>
<!--mstheme--></font><table border="1" width="807" height="66" style="border-style: solid; border-width: 1" bordercolordark="#660000" bordercolorlight="#CC9966">
<tr>
<td width="300" rowspan="2" height="38" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">规格及型号</font><!--mstheme--></font></td>
<td width="210" rowspan="2" height="38" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">期初数量</font><!--mstheme--></font></td>
<td width="576" colspan="3" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">本月入库</font><!--mstheme--></font></td>
<td width="960" colspan="5" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">本月出库</font><!--mstheme--></font></td>
<td width="192" rowspan="2" height="38" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">本月结存</font><!--mstheme--></font></td>
<tr>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">包装入库</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">客户退回</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">小计</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">客户销售</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">退返修组</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">发样品组</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">其它发货</font><!--mstheme--></font></td>
<td width="192" height="16" valign="middle" align="center"><!--mstheme--><font face="宋体"><font face="楷体_GB2312" size="1">小计</font><!--mstheme--></font></td>

<%
do while not rs.eof
abc = rs("goodsid")
exec1="select sum(billqty) as a from c_gccs where goodsid ="&abc
set rs1=server.createobject("adodb.recordset")
rs1.open exec1,conn,1,1

exec2="SELECT sum(i_otherind.qty) as b FROM i_otherind ,i_otherin WHERE i_otherind.billid = i_otherin.billid and OINTYPEID = 1 AND i_otherind.goodsid = "&ABC
set rs2=server.createobject("adodb.recordset")
rs2.open exec2,conn,1,1

exec3="SELECT SUM(QTY*-1) as c FROM S_SENDD WHERE qty<0 and goodsid =" &abc
set rs3=server.createobject("adodb.recordset")
rs3.open exec3,conn,1,1

exec4="SELECT SUM(QTY) as d FROM S_SENDD WHERE qty>0 and goodsid =" &abc
set rs4=server.createobject("adodb.recordset")
rs4.open exec4,conn,1,1

exec5="SELECT sum(i_otherind.qty*-1) as e FROM i_otherind ,i_otherin WHERE i_otherind.billid = i_otherin.billid and OINTYPEID = 2 AND i_otherind.goodsid = "&ABC
set rs5=server.createobject("adodb.recordset")
rs5.open exec5,conn,1,1

exec6="SELECT sum(i_otheroutd.qty) as f FROM i_otherout ,i_otheroutd WHERE i_otherout.billid = i_otheroutd.billid and i_otherout.OOUTTYPEID = 3 AND i_otheroutd.goodsid = "&ABC
set rs6=server.createobject("adodb.recordset")
rs6.open exec6,conn,1,1

exec7="SELECT sum(i_otheroutd.qty) as g FROM i_otherout ,i_otheroutd WHERE i_otherout.billid = i_otheroutd.billid and i_otherout.OOUTTYPEID = 1 AND i_otheroutd.goodsid = "&ABC
set rs7=server.createobject("adodb.recordset")
rs7.open exec7,conn,1,1
%>
<tr>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font face="宋体" size="1"><%=rs("MEMORYCODE")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs1("a")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs2("B")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs3("c")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs2("b")+rs3("c")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs4("d")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs5("e")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs6("F")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs7("g")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs4("d")+rs5("e")+rs6("f")+rs7("g")%></font><!--mstheme--></font></td>
<td width="192" height="16"><!--mstheme--><font face="宋体"><font size="1"><%=rs1("a")+rs2("b")+rs3("c")-rs4("d")-rs5("e")-rs6("f")-rs7("g")%></font><!--mstheme--></font></td>
<%
rs.movenext
loop
%>

</table><!--mstheme--><font face="宋体">

</center>
</div>

<!--mstheme--></font></body>

</html>

搜索更多相关主题的帖子: Microsoft content include where file 
2007-04-04 12:30
小鹤
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-28
收藏
得分:0 
什么意思??
2007-04-04 12:33
xtyby
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-4-1
收藏
得分:0 
上述代码有以下几个问题
一、如果SQL语句得出的值为空的时候就不能在小计列计算。
二、如果SQL语句得出的值为空的时候列就不会划线《所在单元格就没有格子》。
三、有什么更好方法解化一下我的代码。
小弟在此先谢过各位了。
2007-04-04 12:36
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
如果SQL语句得出的值为空时就赋该值为0

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-04-04 12:42
小鹤
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-28
收藏
得分:0 

你可以先简化一下你那7个sql语句,求和什么的在sql语句里面计算,或者在数据库里做个视图什么的
值为空的时候你可以这么写
" "&rs("a")或者"&nbsp;"&rs("a"),这样值就不是空了

2007-04-04 12:43
xtyby
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-4-1
收藏
得分:0 
我是从INTERBASE数据库取数的,
这种数据库不支持ISNULL,所以只有在ASP里改。
还有一个问题两列相加,如果有一列为空就加不出来。
不知道有没有办法解决
2007-04-04 16:49
xtyby
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-4-1
收藏
得分:0 

有没高手帮忙解决一下,两列相加。

2007-04-04 20:59
快速回复:关于空值问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026157 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved