急求无效使用 Null: 'Replace'的解决办法

better1228 2009-09-16 09:42:56
以下是程序代码
<%
'新闻排行
'ClassID类别ID
'NewNum新闻条数
'TitleLen标题字符长度
'OrderType排序类型:0-日排行,1周排行,2月排行
sub NewsListOrderBy(ClassID,NewNum,TitleLen,OrderType)
dim whereString
sql = "select top " & NewNum & " htmlPath,title,Hits from ["& Cfg.tablePrefix &"news]"
if ClassID = "" then
sql = sql & " where isRec = 0 and isSign = 1"
else
sql = sql & " where classId = " & ClassID & " and isRec = 0 and isSign = 1"
end if
Select Case OrderType
Case 0
whereString = "and datediff(hour,createDate,getDate()) < 24"
Case 1
whereString = "and DATEPART(wk, createDate) = DATEPART(wk, GETDATE()) and DATEPART(yy, createDate) =

DATEPART(yy, GETDATE())"
Case 2
whereString = "and datediff(m,getdate(),createDate)=0"
End Select
sql = sql & whereString
sql = sql & " order by Hits desc"
rs = dbo.query(sql)
if isnull(rs) or isempty(rs) then
response.Write("暂无数据")
else
for i = 0 to ubound(rs,2)
htmlPath = rs(0,i)
title = rs(1,i)
Hits = rs(2,i)
(错误行) htmlPath = replace(htmlPath,"/news/","")


%>
<tr>
<td width="20" align="middle" > <img src="images/0731_t <%=i+1%>.gif" width="15" height="14" /> </td>
<td height="24" align="left"> <a href=" <%= htmlPath %>" title=" <%= title %>" target="_blank"> <% =

lib.cut_Title(title,TitleLen) %> </a> </td>
<td width="30"> <% = Hits %> </td>
</tr>
<%
next
end if
set rs = nothing
end sub
%>

在站里也看了相关的帖子,但本人asp水平有限,具体的如何解决还请各位老师多多帮助,在这里谢过大家了。
...全文
133 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
better1228 2009-09-16
  • 打赏
  • 举报
回复
谢谢你,按照你的方法问题已经解决!
三楼の郎 2009-09-16
  • 打赏
  • 举报
回复
htmlPath = replace(htmlPath,"/news/","")
改成:
if not isnull(htmlpath) then
htmlpath=replace(htmlPath,"/news/","")
else
htmlpath=""
end if
试试

28,391

社区成员

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

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