Yesterday to help a friend wrote a simple, below I will be a step-by-step from the establishment of the database after the download and display statistics times bar.
First, the database structure is as follows.
Access database is used, there are two records, we only in the down.asp connection address is such as count.asp?id=1 can download statistics mateydb software, the following we look at count.asp file it.
<!--#include file= "inc/conn.asp"-->
<%
id = Request ("id")
If not IsNumeric (ID) or id = "" Then
Response.Write (' download failed, record does not exist! ') ("<script>alert"); History.back ();</script> ")
Response.End ()
Else
Db_connect ()
SQL = "SELECT * from Soft_count where id=" &id
Rs.Open sql,conn,1,3
If not rs.eof Then
Rs (3) =rs (3) +1
Rs.update
Response.Redirect (Rs (2))
Else
Response.Write (' download failed, record does not exist! ') ("<script>alert"); History.back ();</script> ")
End If
Call Closedb ()
End If
%>
Database connection I will not write, the statistical code is complete, the following to see the display file show.asp
<!--#include file= "inc/conn.asp"-->
<%
Db_connect ()
SQL = "SELECT * FROM Soft_count"
Set Rs =conn.execute (SQL)
Do as not rs.eof
Response.Write ("Software:" &rs (1) & "| Download: "&rs (3) &" Times <br> ")
Rs.movenext
Loop
%>
All right, we're done with our paperwork. Reprint please indicate from www.111cn.net/asp/asp.html