<%Do Until UserRecordSet.EOF
tot1=0
%>
| <%response.write textmessage%> |
<%'tot1 = tot1 + tot%>
<%for i=1 to novoters %> <%Next%><%Response.Write formatpercent(perct)%> |
<%Response.Write vote & " Surfer(s) voted"%> |
<%
UserRecordSet.MoveNext
Loop%>
| |
|
|
<%
SQLString="SELECT Total FROM PollWed"
Set DatabaseConnection=Server.CreateObject("ADODB.Connection")
DatabaseConnection.Open "wedding"
Set UserRecordSet=Server.CreateObject("ADODB.Recordset")
UserRecordSet.CursorType=1
UserRecordSet.CursorLocation=2
UserRecordSet.LockType=3
UserRecordSet.ActiveConnection=DatabaseConnection
UserRecordSet.Open SQLString, DatabaseConnection
total2= UserRecordSet("Total")
UserRecordSet.Close
%>
<% Response.Write "Total number of votes : " & total2%>
|
<%
DatabaseConnection.Close
End Sub
'######subroutine#####
Sub CalTotal
Dim SQLString, DatabaseConnection, UserRecordSet,vote,dec
SQLString="SELECT Voting,Total,Percent,Round FROM PollWed"
Set DatabaseConnection=Server.CreateObject("ADODB.Connection")
DatabaseConnection.Open "wedding"
Set UserRecordSet=Server.CreateObject("ADODB.Recordset")
UserRecordSet.CursorType=1
UserRecordSet.CursorLocation=2
UserRecordSet.LockType=3
UserRecordSet.ActiveConnection=DatabaseConnection
UserRecordSet.Open SQLString, DatabaseConnection
total=0
Do Until UserRecordSet.EOF
vote= UserRecordSet("Voting")
total= UserRecordSet("Total")
UserRecordSet("Total")= total + 1
UserRecordSet("Percent")= (vote / (total + 1))
dec = (UserRecordSet("Percent")* 10000)\100
UserRecordSet("Round")= dec
'UserRecordSet.Update
UserRecordSet.MoveNext
Loop
UserRecordSet.Close
DatabaseConnection.Close
end sub %> |