| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 552 人关注过本帖
标题:[求助]为什么不能比较大小?
只看楼主 加入收藏
zhyl19701028
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2005-12-9
收藏
 问题点数:0 回复次数:3 
[求助]为什么不能比较大小?

<%
Dim connc
fac_server="ora9"
uid1="ytcx"
pwd1="scytcx"

set connc = server.createobject("Adodb.Connection")
connc.Open "Provider=OraOLEDB.Oracle.1;Persist Security Info=True;Password="&pwd1&";User ID="&uid1&";Data Source="&fac_server&""
%>

<%on error resume next
dim aa1(600),jh1(600),jingh(600),dbb(600),riqii(600),shij(600),dymcc(600),cengw(600),gany(600),youy(600),taoy(600),peiz(600),shiz(600),cds(600),beiz(600),qsz(600),cz(600)
dim riqi1,riqi2,pz,shz,js,bd1,bd2
bd1=request.form("db1")
bd2=request.form("db2")
y1=request.form("year1")
m1=request.form("month1")
d1=request.form("day1")
y2=request.form("year2")
m2=request.form("month2")
d2=request.form("day2")
riqi1=y1&m1&d1
riqi2=y2&m2&d2

%>
<%
'取井号

exec1="select distinct JH from YS_DBA02 where (DWDM like '3020046%' or DWDM like '3020047%') order by JH"
Set RS1= Server.CreateObject("ADODB.RecordSet")
rs1.Open exec1,Connc,1,2

i=0
do while not rs1.eof
if rs1("JH")<>"" and rs1("JH")<>"0" then
jh1(i)=rs1("JH").value
i=i+1
end if
rs1.movenext
loop
rs1.close
set rs1=nothing

numb=i


i=0
for j=0 to numb-1

exec2="select rzsl from YS_DBA02 where JH='"&jh1(j)&"' and (DWDM like '3020046%' or DWDM like '3020047%') and to_char(rq,'yyyymmdd')='"&riqi1&"'"
Set RS2= Server.CreateObject("ADODB.RecordSet")
rs2.Open exec2,Connc,1,2

exec3="select * from YS_DBA02 where JH='"&jh1(j)&"' and (DWDM like '3020046%' or DWDM like '3020047%') and to_char(rq,'yyyymmdd')='"&riqi2&"'"
Set RS3= Server.CreateObject("ADODB.RecordSet")
rs3.Open exec3,Connc,1,2


if not rs2.eof and not rs3.eof then

aa1(i)=abs(formatnumber(rs3("RZSL"))-formatnumber(rs2("RZSL")))

'response.write formatnumber(aa)
'response.write "/"
response.write formatnumber(bd1)
response.write formatnumber(bd2)

'response.write formatnumber(aa1(i))
response.write "/"
if (aa1(i))>=bd1 and (aa1(i))<bd2 then

i=i+1
jingh(i)=rs3("JH")
dbb(i)=rs3("DWMC")
riqii(i)=rs3("RQ")
shij(i)=rs3("SCSJ")
dymcc(i)=rs3("DYMC")
cengw(i)=rs3("ZSCW")
gany(i)=rs3("GXYL")
youy(i)=rs3("YY")
taoy(i)=rs3("TY")
peiz(i)=rs3("RPZSL")
shiz(i)=rs3("RZSL")
cds(i)=rs3("PZCDS")

beiz(i)=rs3("BZ")
qsz(i)=rs2("RZSL")
cz(i)=formatnumber(shiz(i))-formatnumber(qsz(i))

end if

end if


next
num=i
rs2.close
set rs2=nothing

rs3.close
set rs3=nothing


connc.close
set connc=nothing

%>

问题是:
if (aa1(i))>=bd1 and (aa1(i))<bd2 then不起作用
如果直接赋值 if (aa1(i))>=100 and (aa1(i))<1000 then就没有问题

用类型转换 if formatnumber(aa1(i))>=formatnumber(bd1) and formatnumber(aa1(i))<formatnumber(bd2) then也不行

2005-12-13 13:41
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5810
专家分:118
注 册:2005-4-7
收藏
得分:0 
if cint(aa1(i))>=cint(bd1) and cint(aa1(i))<cint(bd2) then

2005-12-13 13:44
zhyl19701028
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2005-12-9
收藏
得分:0 
谢谢
谢谢hxfly版主为什么比较大小非的用CInt,而formatnumber和csng不行?你有QQ号?

向您学习
2005-12-13 16:45
bigfnh
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2005-12-11
收藏
得分:0 

我的QQ是403933631(写明,是ASP)

2005-12-14 13:24
快速回复:[求助]为什么不能比较大小?
数据加载中...
 
   



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

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