网络编程 
首页 > 网络编程 > 浏览文章

asp提示无效使用 Null: Replace

(编辑:jimmy 日期: 2024/5/20 浏览:3 次 )

使用REPLACE来将数据库里读出来的数据替换,如果字段不为空是正常,但如果
为空时就出现以下提示:

Microsoft VBScript 运行时错误 错误 '800a005e'

无效使用 Null: 'Replace'

主要问题就是sqlserver的字段为null,所以不能简单的为空判断,只能使用isnull

可以先判断
if isnull(rs("coutent"))=false then
response.write("null")
else
response.write replace(rs("coutent"),chr(13),"<br/>")
end if

测试:

复制代码 代码如下:
if isnull(keyword)=true then keyword=dxy_title
if isnull(descriptions)=true then descriptions=dxy_title

上一篇:ASP 连接 SQL SERVER 2008的方法
下一篇:ASP(VBScript)中整除和取余
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网