access数据库用的方法:
instr(','+speciality+',',',2,')<>0
完整的代码如下:
function update08()
dim templatefilepath
templatefilepath=server.mappath("../../../default.htm")
dim tclass,strhtml
set tclass=new tkl_templateclass
strhtml=""
dim rs,sql
sql="select top 8 title,filepath,addtime from view_newsinfo where instr(','+speciality+',',',18,')<>0 order by id desc"
set rs=conn.execute(sql)
while not rs.eof
strhtml=strhtml&"·[" & strclass.formatmydate(rs("addtime"),"{m}/{d}") & "]<a href=""" & rs("filepath") & """ target=""_blank"">" & rs("title") & "</a><br>" & vbcrlf
rs.movenext
wend
rs.close
set rs=nothing
with tclass
.opentemplate(templatefilepath)
.startelement="<!--downrecommand:start-->"
.endelement="<!--downrecommand:end-->"
.value=strhtml
.replacetemplate()
.save()
end with
set tclass=nothing
end function
如果这段使用在sql中会提示'instr' 不是可以识别的 函数名。
sql数据库更新应用:
dbo.isspeciality(speciality,'2')>0
完整代码如下:
'//下载中心 - 推荐
function update08()
dim templatefilepath
templatefilepath=server.mappath("../../../default.htm")
dim tclass,strhtml
set tclass=new tkl_templateclass
strhtml=""
dim rs,sql
sql="select top 8 title,filepath,addtime from view_newsinfo where dbo.isspeciality(speciality,'18')>0 order by id desc"
set rs=conn.execute(sql)
while not rs.eof
strhtml=strhtml&"·[" & strclass.formatmydate(rs("addtime"),"{m}/{d}") & "]<a href=""" & rs("filepath") & """ target=""_blank"">" & rs("title") & "</a><br>" & vbcrlf
rs.movenext
wend
rs.close
set rs=nothing
with tclass
.opentemplate(templatefilepath)
.startelement="<!--downrecommand:start-->"
.endelement="<!--downrecommand:end-->"
.value=strhtml
.replacetemplate()
.save()
end with
set tclass=nothing
end function
如对本文有疑问,
点击进行留言回复!!
网友评论