SAVE of multi-question voting statistics system-Original

Source: Internet
Author: User
Tags table name
<! --
// SAVE of the multi-question voting statistics system
// Prepared by: CHEERY_KE version: 1.0
// Supported: ASP + ACCESS WINDOWS2000 PRO + IIS5.0 passed the test
// Disadvantage: data is exchanged between each question and the database. This action is relatively large and does not apply to multi-question voting (> 20 ?)
// Advantage: using a data table makes operations and statistics easier.
// ------ Data table structure ------
// In this example, the database name is 111.mdband the table name is 111
// The question number is the field value, and an ID is added. The total number of questions + 1 field
// The result indicates the ID of each record, that is, A, B, C, D, E ...... Records
<% On error resume next %>
'Define database connection
Set conn = SERVER. CreateObject ("ADODB. CONNECTION ")
DBPath = SERVER. MapPath ("111.MDB ")
CONN. Open "DRIVER = {Microsoft Access Driver (*. mdb)}; dbq =" & DBPath
'Define the array MYARRAY (X), where X is the number of questions + 1
Dim myarray (6)
MYARRAY (0) = ""
'Define the cyclic variable I
I = 1
'Declare I> exit the loop when the number of questions is reached
Do while not I> 5
'Define RS
Set rs = SERVER. CreateObject ("ADODB. RECORDSET ")
'Define the SQL variable, "S" & I & "is the question sequence number, and ID is the result
SQL = "UPDATE 111 set s" & I & "= S" & I & "+ 1 where id = '" & MYARRAY (I )&"'"
RS. Open SQL, CONN, 3, 2
'Release RS and SQL variables
Set rs = NOTHING
I = I + 1
Response. Write ("<CENTER> <BR> saved your vote succed !! </CENTER> ")
Response. Write ERR. DESCRIPTION
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.