Multiple voting statistics System save chapter-Original

Source: Internet
Author: User
Statistics | voting | Original <!--
Save chapter of the multi-question voting statistic system
Author: Cheery_ke Version: 1.0
Support: asp+access WINDOWS2000 PRO + IIS5.0 test passed
Disadvantage: Each question and the database Exchange data once, the action is bigger, does not apply to the question of many questions to vote (>20? )
Advantages: The use of a data table, operation, statistics are relatively simple
—————— data table Structure ——————
In this case, the database name is 111.MDB and the table name is 111
The topic number is the field value, plus one ID, the total number of questions + 1 fields
The result flag is the ID value of each record, that is, a total of a,b,c,d,e ... Record
-->
<% @LANGUAGE =vbscript%>
<%on ERROR RESUME next%>
<%
' Define a database connection
SET Conn=server. CreateObject ("ADODB.") CONNECTION ")
Dbpath=server. MapPath ("111.MDB")
CONN. Open "Driver={microsoft Access DRIVER (*.mdb)};d bq=" &dbpath

' Define array myarray (x), where x is the number of topics +1
DIM MyArray (6)
MyArray (0) = ""
MyArray (1) =request ("R1")
MyArray (2) =request ("R2")
MyArray (3) =request ("R3")
MyArray (4) =request ("R4")
MyArray (5) =request ("R5")

' Define loop variable i
I=1

' Declare i> the number of questions to exit the loop
Do as not i>5

' Define RS
SET Rs=server. CreateObject ("ADODB.") RECORDSET ")

' Define SQL variable, S ' &I& ' is the title number, ID is the result
Sql= "UPDATE SET S" &I& "=s" &I& "+1 WHERE id= '" &myarray (I) & "'"
Rs. Open sql,conn,3,2

' Release RS and SQL variables
SET rs=nothing
SET sql=nothing

I=i+1
LOOP

Response.Write ("<center><br><br>saved YOUR VOTE succed!! </CENTER> ")
Response.Write ERR. DESCRIPTION
%>



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: info-contact@alibabacloud.com 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.