急求无效使用 Null: 'Replace'的解决办法
以下是程序代码<%'新闻排行'ClassID类别ID'NewNum新闻条数'TitleLen标题字符长度'OrderType排序类型:0-日排行,1周排行,2月排行sub...
以下是程序代码
<%
'新闻排行
'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
%> 展开
<%
'新闻排行
'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
%> 展开
2个回答
展开全部
数据库NULL值的问题
如果真这样,程序由于NULL值出了问题
还不如改改数据库结构简单的多
字段不为NULL,插入赋空就行了。
如果真这样,程序由于NULL值出了问题
还不如改改数据库结构简单的多
字段不为NULL,插入赋空就行了。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
展开全部
ASP???
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询