%@ Language=VBScript %>
<%
nopolls = "no"
Dim RS, strSQL, strName
Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT PollOptions.PollID AS optPollID, " & _
"PollOptions.PollText AS optPollText, PollOptions.UID as UID, Poll.PollID, Poll.PollName, " & _
"Poll.PollText, Poll.PollType, Poll.PollItemCount, Poll.StartDate, " & _
"Poll.EndDate, Poll.Image " & _
"FROM Poll INNER JOIN " & _
"PollOptions ON Poll.PollID = PollOptions.PollID " & _
"WHERE (StartDate <='" & date() & "' AND EndDate >= '" & date() & "') ORDER BY PollOptions.PolLText"
'Response.Write strSQL & "
"
'Response.End
RS.Open strSQL, oConn, 1, 1
%>
SA - HYPERTENSION VOTES
 |
 |
 |
 |
| |
 |
|
|
<%'--------------begin vote poll------------------------------------------------------------------------
if RS.RecordCount > 0 then
%>
<%
else
%>
| There are currently no Polls to vote on. |
<%
nopolls = "yes"
end if
'Response.Write date()
RS.Close
Set RS = nothing
'- end vote poll -------------------------------------------------------------------------------%>
<%'---begin poll results -----------------------------------------------------------------------%>
<% if nopolls = "no" then
Dim RSResults, strResultsSQL
Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT *, Poll.PollID AS PollID, Poll.PollName AS PollName, " & _
"Poll.PollText AS PollText, PollOptions.PollText AS [Option], " & _
"PollOptions.UID AS Expr2 FROM Poll INNER JOIN " & _
"PollOptions ON Poll.PollID = PollOptions.PollID " & _
"WHERE (Poll.PollID = " & thisPollid & ") ORDER BY PollOptions.PolLText"
RS.Open strSQL, oConn, 1, 1
Set RSResults = Server.CreateObject("ADODB.Recordset")
strResultsSQL = "SELECT * FROM PollChoices WHERE (PollID = " & thisPollid & ")"
RSResults.Open strResultsSQL, oConn, 1, 1
%>
<%
if RSResults.RecordCount > 0 then
%>
| Vote results |
| <%=rs("PolLText")%> |
<%
Dim intCounter, intOptionCounter, intPercent, intTotalVotes
intTotalVotes = 0
Do while not rs.EOF or rs.BOF
%>
| <%=rs("option")%> |
<%
intCounter = 0
RSResults.MoveFirst
do while not RSResults.EOF or RSResults.BOF
if CInt(RSResults("Choice")) = CInt(rs("UID")) then
intCounter = intCounter + 1
end if
%>
<%
RSResults.MoveNext
loop
%>
|
|
<%
'intPercent = FormatNumber(intCounter / RSResults.RecordCount * 100,0)
'for i = 0 to intPercent
' Response.Write " "
'next
intTotalVotes = intTotalVotes + intCounter
%>
|
<%Response.Write intCounter & "(" & (round(100 / RSResults.RecordCount)) * intCounter & "%)"%> |
<%
rs.MoveNext
loop
%>
| <%Response.Write intTotalVotes%> <%if Cint(intTotalVotes) =1 then response.write " Person" else response.write " People" end if %> have voted on this poll. |
<%
else
%>
| Vote results |
| There have been no votes on this topic yet |
<%
end if
%>
<%
RS.Close
Set RS = nothing
end if
%>
<%'---end poll results------------------------------------------------------------------------------%>
|
|
|
| |
|
| |
 |