Object Problem

Results 1 to 2 of 2

Thread: Object Problem

  1. #1
    Join Date
    Dec 1969
    Posts
    94

    Default Object Problem

    I&#039m trying to get a poll system working, but when I press submit on my questionnaire, I get:<BR>===<BR>Object Moved<BR>This object may be found here. <BR>===<BR>Heres the code:<BR>===<BR>&#060;%<BR> Dim strVoted, sqlstmt<BR> strVoted = Request.Cookies("Voted")<BR> Const iWidth = 148<BR> &#039We need to create a dynamic array just big enough to hold<BR> &#039 all of our voting options<BR><BR> if strVoted = "Yes" then<BR> sqlstmt = "SELECT PollOption.PollOptionID, PollOption.QuestionText, PollOption.Votes, " & _<BR> "Poll.PollQuestion " & _<BR> "FROM Poll INNER JOIN PollOption ON Poll.PollID = PollOption.PollID " & _<BR> "WHERE Poll.DateStart &#060;= #" & Date & "# AND Poll.DateEnd &#062;= #" & Date & "#;"<BR> <BR> rsy.Open sqlstmt, adOpenStatic, adLockReadOnly <BR><BR> Dim PollOptions()<BR> Redim PollOptions(rsy.RecordCount,2)<BR><BR> Dim iCount, iTotalVotes, strPollName<BR> iCount = 0<BR> iTotalVotes = 0<BR><BR> strPollName = CStr(rsy("PollQuestion"))<BR><BR> Do While Not rsy.EOF<BR><BR> PollOptions(iCount,1) = CInt(rsy("Votes"))<BR> PollOptions(iCount,2) = CStr(rsy("QuestionText"))<BR><BR> iTotalVotes = iTotalVotes + PollOptions(iCount,1)<BR> iCount = iCount + 1<BR><BR> rsy.MoveNext<BR><BR> Loop <BR> %&#062;<BR> &#060;TABLE BORDER=0 CELLSPACING=0 WIDTH=&#060;%=iWidth%&#062; height="100%"&#062;<BR> &#060;TR&#062;&#060;TH BGCOLOR=#754c97&#062;&#060;FONT COLOR=WHITE FACE=Arial SIZE=2&#062;<BR> &#060;%=strPollName%&#062;<BR> &#060;/FONT&#062;&#060;/TH&#062;&#060;/TR&#062;<BR> &#060;TR&#062;<BR> &#060;TD BGCOLOR="#c49a35"&#062;<BR> &#060;%<BR> Dim iLoop<BR> For iLoop = 0 to iCount-1 %&#062;<BR> &#060;FONT FACE=Arial SIZE=2&#062;&#060;%=PollOptions(iLoop,2)%&#062; (&#060;%=FormatPercent(PollOptions(iLoop,1)/iTotalVotes,1)%&#062;)&#060;/FONT&#062;<BR> &#060;TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0&#062;<BR> &#060;TR&#062;&#060;TD WIDTH=&#060;%=CInt((PollOptions(iLoop,1)/iTotalVotes)*iWidth)%&#062; BGCOLOR=YELLOW&#062;<BR> &nbsp;&#060;/TD&#062;<BR> &#060;/TR&#062;<BR> &#060;/TABLE&#062;<BR> <BR><BR> &#060;% Next %&#062;<BR> &#060;FONT FACE=Arial SIZE=2&#062;Total Votes: &#060;%=iTotalVotes%&#062;&#060;/FONT&#062;<BR> &#060;/TD&#062;&#060;/TR&#062;&#060;/TABLE&#062;<BR> &#060;% else<BR> sqlstmt = "SELECT * FROM Poll INNER JOIN PollOption ON Poll.PollID = PollOption.PollID WHERE Poll.dates &#060;= #" & Date & "# AND Poll.datee &#062;= #" & Date & "#;"<BR> rsy.open sqlstmt, connectme<BR> %&#062;<BR> &#060;FORM METHOD=POST ACTION="pollResults.asp" ONSUBMIT="return OneOptionChecked();" NAME=frmPoll&#062;<BR> &#060;TABLE BORDER=0 CELLSPACING=0 WIDTH=&#060;%=iWidth%&#062; height="100%"&#062;<BR> &#060;TR&#062;&#060;TH BGCOLOR="#754c97"&#062;&#060;FONT COLOR=WHITE FACE=Arial SIZE=2&#062;<BR> &#060;%=rsy("pollq")%&#062;<BR> &#060;/FONT&#062;&#060;/TH&#062;&#060;/TR&#062;<BR> &#060;TR&#062;<BR> &#060;TD BGCOLOR="#c49a35"&#062;<BR><BR> &#060;%<BR> Do While Not rsy.EOF %&#062;<BR> &#060;INPUT TYPE=RADIO NAME=radPoll VALUE="&#060;%=rsy("PollOptionID")%&#062;"&#062;<B R> &#060;FONT FACE=Arial SIZE=2&#062;&#060;%=rsy("QuestionText")%&#062;&#06 0;/FONT&#062;<BR> <BR><BR> &#060;% <BR> rsy.MoveNext<BR> Loop<BR> %&#062;<BR><BR> &#060;INPUT TYPE=HIDDEN NAME="URLFrom" VALUE="&#060;%=Request.ServerVariables("SCRIPT_NAM E")%&#062;"&#062;<BR> <BR>&#060;CENTER&#062;&#060;INPUT TYPE=SUBMIT VALUE="Vote!"&#062;&#060;/CENTER&#062;<BR> &#060;/TD&#062;&#060;/TR&#062;&#060;/TABLE&#062;<BR> &#060;/FORM&#062;<BR> &#060;% end if %&#062;<BR>===<BR>here&#039s the following page:<BR>===<BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;%<BR> Response.ExpiresAbsolute = Now() - 1<BR> &#039All we want to do here is increment the vote count for the voting option<BR> &#039selected...<BR> Dim objConn<BR> dim connectme<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> connectme="DSN=db1"<BR> objConn.Open connectme<BR><BR> &#039Read in our variables<BR> Dim iPollOptionID<BR> iPollOptionID = CInt(Request("radPoll"))<BR> objConn.Execute "UPDATE PollOption SET Votes = Votes + 1 " & _<BR> "WHERE PollOptionID = " & iPollOptionID<BR> objConn.Close<BR> Set objConn = Nothing<BR> &#039We&#039ve gotta write a cookie<BR> Response.Cookies("Voted") = "Yes"<BR> Response.Cookies("Voted").Expires = DateAdd("d",1,Date)<BR> &#039Response.Cookies("Voted").Domain = ".t-smitch"<BR> Response.Cookies("Voted").Path = "/poll" <BR> &#039Send the user back to the previous page<BR> Response.Redirect Request("URLFrom")<BR>%&#062;<BR><BR>===<BR>I know it&#039s alot, but can someone help?<BR><BR>

  2. #2
    Nathan Pond Guest

    Default RE: Object Problem

    I didn&#039t take the time to go through your code. (Sorry, I&#039m on a schedule :-)) But the object moved page comes up when you do a response.redirect. Don&#039t know all the specifics, but it seems that some browsers just go to the next page, others make you click the "here" link to get there.<BR><BR>Nathan

Posting Permissions

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