
11/09/2002, 11:40
|
| | Fecha de Ingreso: febrero-2002 Ubicación: Navarra
Mensajes: 701
Antigüedad: 23 años, 3 meses Puntos: 2 | |
Re: recoger un valor en diferentes variables
Código:
'Check the user has not already voted by reading in a cookie from there system
'Read in the Poll ID number of the last poll the user has voted in
intVotedIDNo = CInt(Request.Cookies("Poll")("PollID"))
'Check to see if the user has voted in this poll
If intVotedIDNo = intPollIDNum Then
'If the user has already voted then return flase
SavePollVotes = False
'Else if the user has not already voted so increment the vote choice total and set a cookie on the users system
Else
'Read in the vote choice numbers from the database
'Create a recordset odject
Set rsSavePollVotes = Server.CreateObject("ADODB.Recordset")
'First we need to read in the present vote number so we can add 1 to it
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM tblPolls WHERE "
For i = 0 To UBound(queIDStr)
If i <> UBound(queIDStr) then
strSQL = strSQL & " id_no = " & queIDStr(i) & " and "
Else
strSQL = strSQL & " id_no = " & queIDStr(i)
End if
Next
'Set the cursor type property of the recordset to Dynamic so we can navigate through the record set
rsSavePollVotes.CursorType = 2
'Set the Lock Type for the records so that the recordset is only locked when it is updated
rsSavePollVotes.LockType = 3
'Query the database
rsSavePollVotes.Open strSQL, strCon
'Do While Not rsSavePollVotes.EOF
textolibre = Request.Form("textolibre")
rsSavePollVotes("textolibre") = textolibre
'Read in the value of the vote choice selected form the database
intVoteChoiceCount = CInt(rsSavePollVotes(strPollVoteChoice))
'Increment the vote choice by 1
intVoteChoiceCount = intVoteChoiceCount + 1
'Update the database with the new poll results
rsSavePollVotes.Fields(strPollVote) = CInt(intVoteChoiceCount)
rsSavePollVotes.Update
sigue |