一个条件语句,一个奇怪的问题

嘉友云阁 2014-03-05 05:46:01
<%

if rs("note_price")<=0 then
response.write("无")
end if

if rs("note_price")>0 then
response.Write(formatnumber(rs("note_price"),2,-1,-1,0))
end if
%>
如上语句。结果显示如下:
不管rs("note_price")是否为零,全部都显示了是怎么回事?
如:
无25.00
无0.00
...全文
126 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2014-03-06
  • 打赏
  • 举报
回复
<% v = rs("note_price").Value If IsNull(v) Then v = 0 If CDbl(v) <= 0 Then response.write "无" Else response.Write formatnumber(v,2,-1,-1,0) End If %>
嘉友云阁 2014-03-06
  • 打赏
  • 举报
回复
引用 2 楼 hookee 的回复:
<% v = rs("note_price").Value If IsNull(v) Then v = 0 If CDbl(v) <= 0 Then response.write "无" Else response.Write formatnumber(v,2,-1,-1,0) End If %>
好用了。。。不懂为什么,但就是了。。。
scscms太阳光 2014-03-06
  • 打赏
  • 举报
回复
if CCur(rs("note_price"))>0 then response.Write(formatnumber(rs("note_price"),2,-1,-1,0)) else response.write("无") end if %>
嘉友云阁 2014-03-05
  • 打赏
  • 举报
回复
note_price字段是decimal型

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧