| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 501 人关注过本帖
标题:求助:ASP使用REPLACE函数参数中有空值报错
只看楼主 加入收藏
a275298873
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2013-10-19
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:1 
求助:ASP使用REPLACE函数参数中有空值报错
file        =    "small.htm"


    '
    call db_conn()
    dim tpl,info
    set tpl        =    new template
    tpl.load file
    info = tpl.result()
    dim ors,isort,bsort
    set ors = server.createobject("adodb.recordset")
    ors.open "select * from [class] where id = " & toint(request("id")),conn,1,1
    if ors.eof then call myerr("未找到相应信息...")
    info = replace(info,"{系列名称}",ors("name"))
    info = replace(info,"{摘要}",ors("mark"))
    info = replace(info,"{内容}",ors("introduce"))
    info = replace(info,"{图片}",ors("pro_picture"))
    info = replace(info,"{规格}",ors("pro_spec"))
    if len(ors("bigpicture")) > 6 then
        info = replace(info,"{下载}","<a href='doc/"&ors("bigpicture")&"' target='_blanl'><img src=images/dowsms.jpg width=105 height=25 border=0></a>")
    else
        info = replace(info,"{下载}","")
    end if
    isort = ors("isort")
    bsort = ors("sort")
    info = replace(info,"{小类}",isort)
    info = replace(info,"{大类}",bsort)
    ors.close
   
运行后报错:
Microsoft VBScript 运行时错误 错误 '800a005e'

无效使用 Null: 'replace'

其中pro_picture,pro_spec是有空值的列,请问如何解决这个错误呢,让结果是如果是空值那么就用空值替换。
搜索更多相关主题的帖子: request replace where file 信息 
2013-10-22 12:06
hugeannex
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:6
帖 子:483
专家分:911
注 册:2005-3-20
收藏
得分:20 
在if ors.eof 中作相应处理,比如退出程序啊,或按你的意思,给info赋一空值,以防后面出错。

世事如潮我如水,只叹江湖几人回。
2013-10-24 11:14
快速回复:求助:ASP使用REPLACE函数参数中有空值报错
数据加载中...
 
   



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

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