Count. asp
'Core counter Program.
<%
Set conn = Server. CreateObject ("ADODB. Connection ")
Dbpath = server. MapPath ("count. mdb ")
Conn. open "driver = {Microsoft Access Driver (*. mdb)}; dbq =" & DbPath
User = Request. QueryString ("user ")
SQL = "update counttable set curvalue = curvalue + 1 where user = '" & user &"'"
'Count value plus1.
Conn. Execute SQL
SQL = "select curvalue from counttable where user = '" & user &"'"
Set rs = conn. Execute (SQL)
Function chgimg (curvalue)
Dim s, I, g
S = cstr (curvalue)
For I = 1 to len (s)
'DefinitionChgimgFunction,Graphically represent the Count value.
G = g & "
'When using the counter,The image path must use the actual path.
Next
Chgimg = g
End function
Toimg = chgimg (rs ("curvalue "))
Toimg = "document. write (" & "'" & toimg &"')"
'CallChgimgFunction incoming counter value.
Response. Write (toimg)
'Output.
Rs. close
Set rs = nothing
Conn. Close
Set conn = nothing
%>
Get.htm
'Application Form.
<Form method = "POST" action = "getcl. asp">
<P>User Name<Input type = "text" name = "user" size = "20"> </p>
<P>Counter Initial Value<Input type = "text" name = "curvalue" size = "20"> </p>
<P>Home address<Input type = "text" name = "pageurl" size = "20"> </p>
<P> <input type = "submit" value ="Submit"Name =" B1 "> <input type =" reset "value ="Rewrite"Name =" B2 "> </p>
</Form>
Getcl. asp
'Form for processing user input,And join the database.
<%
Set conn = Server. CreateObject ("ADODB. Connection ")
'Establish a connection with the database.
Dbpath = server. MapPath ("count. mdb ")
'Obtain the actual path of the database.
Conn. open "driver = {Microsoft Access Driver (*. mdb)}; dbq =" & DbPath
Set rs = server. CreateObject ("adodb. recordset ")
User = Request. Form ("user ")
Pageurl = Request. Form ("pageurl ")
Curvalue = Request. Form ("curvalue ")
'Obtain user information.
SQL = "select * from counttable where user = '" & user &"'"
'Check whether the user name exists.
Rs. Open SQL, conn, 1, 3
If not rs. EOF then
Response. Write "<title>Application error</Title>"
Response. Write"Oh,The user name already exists.!Please reselect... </Title>"
Response. End
'Stop downstream processing,Users are required to refill.
End if
Rs. AddNew
Rs ("user") = user
Rs ("pageurl") = pageurl
Rs ("curvalue") = curvalue
Rs. Update
' Add User information to the database .
Rs. Close
Set rs = nothing
Conn. Close
Set conn = nothing
%>
[1]