Methods used in Access databases:
Instr (', ' +speciality+ ', ', ', ', 2, ') <>0
The complete code is as follows:
Copy Code code as follows:
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+ ', ', ', ', ') <>0 ORDER by Id D ESC "
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
If this paragraph is used in SQL, it prompts ' Instr ' to be a function name that is not recognized.
SQL Database Update application:
Dbo. Isspeciality (Speciality, ' 2 ') >0
The complete code is as follows:
Copy Code code as follows:
'//Download Center-recommended
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, ' ') >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