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
Dim ORS
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
Else
Intmaxid = ORS ("Maxid")
End If
Randomize
Intrecordid= Int (RND * intmaxid) + 1
strSQL = "SELECT * from quotes where quoteid=" & Intrecordid & ";"
Set ORS = Oconn.execute (strSQL)
If ors.eof Then
&nbs