ASP voting system A

Source: Internet
Author: User
The code is as follows Copy Code

<%
Dim Voteid, Choose, Nowid, I, rs,sql
If not IsObject (Conn) Then connectiondatabase

If IsNumeric (Request ("Voteid")) Then
Voteid = CLng (Request ("Voteid"))
Else
Voteid = 0
End If
If Voteid = 0 Then
SQL = "SELECT top 1 * from Nc_vote WHERE islock<>1 order by ID DESC"
Else
SQL = "SELECT * from Nc_vote WHERE id=" & Voteid
End If
Set Rs = Conn.execute (SQL)
If rs.eof Then
Response.Write ("Connection data Error")
Response.End
Else
For i = 1 to 5
If IsNull (Rs ("Choose_" &i)) Then Exit for
Next

Nowid = Rs ("id")

Response.ContentType = "Text/xml"
' Response.Expires =-1
Response.Write "<?xml version=" "1.0" "encoding=" "GB2312" "?>" & vbNewLine
Response.Write "<vote>" & vbNewLine
Response.Write "<system>" & vbNewLine
Response.Write "<voteid>"
Response.Write Rs ("id")
Response.Write "</voteid>" & vbNewLine
Response.Write "<topic><! [cdata[]
Response.Write Rs ("Topic")
Response.Write "]]></topic>" & vbNewLine
Response.Write "<VoteNum>"
Response.Write Rs ("Votenum")
Response.Write "</VoteNum>" & vbNewLine
Response.Write "<votebgcolor><! [cdata[]
Response.Write Rs ("bgcolor")
Response.Write "]]></votebgcolor>" & vbNewLine
Response.Write "<votewordcolor><! [cdata[]
Response.Write Rs ("FontColor")
Response.Write "]]></votewordcolor>" & vbNewLine
Response.Write "<Topicunt>"
Response.Write I-1
Response.Write "</Topicunt>" & vbNewLine
Response.Write "<FontSize>"
Response.Write Rs ("FontSize")
Response.Write "</FontSize>" & vbNewLine
Response.Write "<VoteType>"
Response.Write CBool (Rs ("Votetype"))
Response.Write "</VoteType>" & vbNewLine
Response.Write "</system>" & vbNewLine

For i = 2 to 6
If IsNull (Rs (i)) Then Exit for
Response.Write "<Choose>" & vbNewLine
Response.Write "<csco><! [cdata[]
Response.Write Rs (i)
Response.Write "]]></csco>" & vbNewLine
Response.Write "<Choosenum>"
Response.Write Rs (i + 5)
Response.Write "</Choosenum>" & vbNewLine
Response.Write "</Choose>" & vbNewLine
Next
End If
Rs.close
Set Rs = Nothing
Response.Write "<prenext>" & vbNewLine
Response.Write "<next>"
SQL = "SELECT * from Nc_vote WHERE id>" & Nowid & "and Islock<>1"
Set Rs = Conn.execute (SQL)
If not (RS.BOF and rs.eof) Then
Response.Write Rs ("id")
End If
Rs.close
Set Rs = Nothing
Response.Write "</next>" & vbNewLine
Response.Write "<pre>"
SQL = "SELECT * from Nc_vote WHERE id<" & Nowid & "and islock<>1 ORDER by ID DESC"
Set Rs = Conn.execute (SQL)
If not (RS.BOF and rs.eof) Then
Response.Write Rs ("id")
End If
Rs.close
Set Rs = Nothing
Response.Write "</pre>" & vbNewLine
Response.Write "</prenext>" & vbNewLine
Response.Write "</vote>" & vbNewLine

Closeconn
%>

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.