Please help!

Results 1 to 2 of 2

Thread: Please help!

  1. #1
    Join Date
    Dec 1969

    Default Please help!

    Below is code to update a visitors vote for their favorite site. All of the Debug message display exactly what I expect and I don&#039t get any errors, but absolutely nothing happens!<BR><BR>I&#039m one frustrated newbie!<BR><BR>TIA, Dani<BR><BR>&#060;%<BR> Dim strSQL<BR> Dim rsVotes<BR> <BR> <BR> strSQL="SELECT * FROM Votes WHERE CasinoID=" & Request.QueryString("CasinoID") & _<BR> " AND Date=" & Date() & _<BR> " AND Voter=&#039Dani&#039" &#039hard coded for now<BR><BR> &#039Debug -- Response.write(strSQL) <BR> <BR> Set rsVotes=server.createobject("ADODB.RECORDSET")<BR> strSQL,Application("pbs_ConnectionString"),3,4<BR> <BR>&#039Debug<BR>Response.write(rsVotes.recordcou nt) & ", " &#039displays 0<BR><BR> If rsVotes.recordcount &#060; 1 Then<BR> rsVotes.addnew<BR> rsVotes.Fields("Date") = Date()<BR> rsVotes.Fields("CasinoID") = Request.QueryString("CasinoID")<BR> rsVotes.Fields("Voter") = "Troy"<BR> rsVotes.Fields("Vote") = 5<BR><BR>&#039Debug (these all display the data from above)<BR>Response.write("Date: ") & rsVotes.Fields("Date") & ", "<BR>Response.write("CasID: ") & rsVotes.Fields("CasinoID") & ", "<BR>Response.write("Voter: ") & rsVotes.Fields("Voter") & ", "<BR>Response.write("Vote: ") & rsVotes.Fields("Vote") & ", "<BR><BR>Response.write("updating")<BR> rsVotes.update<BR> <BR> Response.write("Thank you for your vote! Please wait while you are returned to the main page.")<BR> Else<BR> Response.write(rsVotes.recordcount)<BR> Response.write(" allows each visitor to vote once per day. Thank you!")<BR> Response.write("Please wait while you are returned to the main page.")<BR> End If <BR> <BR>&#039Debug<BR>Response.write("Closing recordset")<BR> rsVotes.close<BR><BR> &#039Response.redirect("index.htm")<BR> <BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Please help!

    I am assuming if there are no records then it ads a new record?<BR>If so you might want to start where it says:<BR>If rsVotes.recordcount &#060; 1 Then<BR>(create another sql statement use the INSERT method to create the new record instead of using the update method)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts