ACCESS數(shù)據(jù)庫用的方法:
Instr(','+Speciality+',',',2,')>0
完整的代碼如下:
復(fù)制代碼 代碼如下:
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}/ytmtzdi") "]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' 不是可以識別的 函數(shù)名。
SQL數(shù)據(jù)庫更新應(yīng)用:
dbo.IsSpeciality(Speciality,'2')>0
完整代碼如下:
復(fù)制代碼 代碼如下:
'//下載中心 - 推薦
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}/hulbtxm") "]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