<!--#include file="../conns.asp"-->
<!--#include file="../inc/const.asp"-->
<%
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("连接数据发生错误")
	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
%>
