首页 > 网站 > 建站经验 > 正文

asp提示无效使用 Null: Replace

2019-11-02 15:50:05
字体:
来源:转载
供稿:网友

 使用REPLACE来将数据库里读出来的数据替换,如果字段不为空是正常,但如果

为空时就出现以下提示:

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

无效使用 Null: 'Replace'

中国历史事件[www.9-39.com/html/china/]

主要问题就是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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表