Some of the previously collected information---Use the ASP to easily build their own web site daily updates

Source: Internet
Author: User
Use ASP to easily create daily updates of your own website
What is the daily update I think we all should know,
Actually a bit like now many news website's update, below describes how to let your
The content of the website is updated automatically every day
The following code applies to:
1. Use any ODBC-compliant database
2. Easy to insert into your existing ASP program
How do I save updated content?
Database structure: (altogether three fields)
Quoteid (Long), Quote (String), Author (String)
The next tip is how to get updates to appear on any page?
We simply send the updated content and the author back to the calling page.
The code is as follows, where logic is a random number that indicates which record is displayed randomly from the database:
Sub getquote (ByVal strquote, ByVal strauthor)
Dim Intmaxid
Dim Intrecordid
Dim strSQL
Dim oconn

set oconn = Server.CreateObject ("ADODB. Connection ")
oConn.Open "database=mydb;dsn=quotes; Uid=sa; password=; "

strSQL = "Select Maxid=max (Quoteid) from quotes"
Set ORS = Oconn.execute (strSQL)
If ors.eof Then
Strquote = "Webmaster is too lazy to update the content today."
Strauthor = "hehe"
Exit Sub
Intmaxid = ORS ("Maxid")
End If

Intrecordid= Int (RND * intmaxid) + 1
strSQL = "SELECT * from quotes where quoteid=" & Intrecordid & ";"
Set ORS = Oconn.execute (strSQL)
If ors.eof Then

Related Article

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: 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.