|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
asp做数学除法运算的问题,高手帮帮我
因为要做数学除法运算,被除数不能为零和空,然后约小数点2位.值为空时好像有问题,高手帮帮我
%
dim vid
if P_all.Fields.Item("vid").Value = 0 Then
vid = 0.0000000001
elseif not P_all.EOF Or not P_all.BOF Then
vid = (P_all.Fields.Item("vid").Value)
else
vid = 0.0000000001
end if
%> |
出现什么错误??
是不是数据类型有问题呢??? |
当P_all.Fields.Item("vid").Value 是空时,他反回的是0.不是指定值 |
用的都是int类型 |
if not P_all.EOF Or not P_all.BOF Then
if isemtpty(P_all.Fields.Item("vid").Value) then
vid=0.000000001
elseif P_all.Fields.Item("vid").Value = 0 Then
vid = 0.0000000001
else vid = (P_all.Fields.Item("vid").Value)
end if
else ******
end if |
谢谢! isemtpty好像是 isempty才行
问题还没解决,返回的值还是空 |
呵呵,解决了,原来很用简单的就行了
<% dim vid3
vid3=0.00000001
If (gjjg_bd.Fields.Item("tbprice").Value)=0 Then
vid3 = 0.00000001
elseif (gjjg_bd.Fields.Item("tbprice").Value)>0 then
vid3 = (gjjg_bd.Fields.Item("tbprice").Value)
else
vid3 = 0.00000001
end if
%>
负数加个<0就行了 |
感觉我写应该没错吧?
加<0干吗?加哪?
|
你写的很好,但是我用不了.呵呵
好多函数还不会用.
如果有负数的就加,不能用<>0
|
|