答案:ACCESS数据库用的方法:
Instr(','+Speciality+',',',2,')<>0
完整的代码如下:[复制此代码]CODE: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.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
完整代码如下:[复制此代码]CODE:'//下载中心 - 推荐
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.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
上一个:TSYS资源特性的效率提高方法
下一个:PJ-Blog教程┊增强博客用户体验~让发表内容的同时拷贝到剪贴板以防丢失