Tsys How to update the foreground when you have a variety of news features? _ Application Tips

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.