The following describes the database to implement a simple counter
'Save under Count.asp
<%
Set conn = server.createObject ("adoDb.connection")
Conn.open "Driver = {Microsoft Access Driver (* .mdb)}; dbq =" & Server.mappath ("count.mdb")
%>
<% on error resume next%>
<% SQL = "Update Count Set Hit = Hit 1%> <% Conn.execute (SQL)%>
<% sql = "SELECT * from country
SET RS = Conn.execute (SQL)
%>
<%
'Update daily data
Lasthit = RS ("Lasthit")
TDATE = Year (now ()) & "-" & month ()) & "-" & day (now ())
if Trim (Lasthit) = Trim (TDATE) THEN
SQL = "Update Site set dayhit = dayhit 1 where id =" & requirements ")
CONN.EXECUTE (SQL)
'Response.write "Success"
Else
SQL = "Update Site set dayhit = 1 where id =" & request ("id")
CONN.EXECUTE (SQL)
'Response.write "Error"
END IF
SQL = "Update Site Set LastHit = '" & TDATE & "' Where ID =" & Request ("ID")
CONN.EXECUTE (SQL)
P_year = cint (Year (NOW ())) - CINT (Year (LastHit))
p_month = cint (Month (now ())) - CINT (Month (lasthit))
p_day = cint (day (now ())) - CINT (day (life (lasthit))
PERIOD_TIME = ((p_year * 12 p_month) * 30 p_day)
IF cint = SQL = "Update Site set weekhit = weekhit 1 where id =" & required ("id") CONN.EXECUTE (SQL) Else SQL = "Update Site Set WeekHit = 1 where id =" & request ("id") CONN.EXECUTE (SQL) END IF %> Document.write (' SET RS = NOTHING%> Today's visit <% = rs ("dayhit")%> times, this week access <% = rs ("WeekHit")%> times, total access <% = rs ("HIT")%> times td> tr> '); <% rs.close