I am trying to use the value of a recordset of a query to update a second table.<BR><BR>"UPDATE QUESTIONS SET VOTES = VOTES +1 WHERE QUESTID = " & rs("QUEST_ID") & " "<BR>this doesnt not work. how would i write it? <BR>thanks
1) Is VOTES an integer? Both in your db (datatype) and the value of the variable?<BR>2) Did you Response.Write your VOTES variable to make sure it *has* a value and did you Response.Write your SQL statement?<BR><BR>3) I'll assume this update statement is actually assigned to a variable of some sort? Because you don't show it that way here.<BR><BR>4) Are you getting an actual error message, or does your update just not show in the database?
Your still not saying the output of your response.write and whether or not you get an error. *WAIT*...couldn't help but notice you have QUESTID and rs("QUEST_ID")...One with an underscore and one without...Should it be like that?<BR><BR>Without knowing all that above, all I can say is, try to rework your SQL statement<BR>SQL = "UPDATE QUESTIONS SET VOTES = VOTES + 1 " _ <BR>& " WHERE QUESTID = " & rs("QUEST_ID")<BR><BR>QUESTID *is* an integer in your db, correct?
Sorry just typed it wrong here. this is what it is:<BR>set cmdUpdateQuest = Server.CreateObject("ADODB.Command")<BR> cmdUpdateQuest.ActiveConnection = ConnectString<BR> cmdUpdateQuest.CommandText = "UPDATE QUESTIONS SET VOTES = VOTES +1 WHERE QUEST_ID = " & rs("QUEST_ID") <BR> cmdUpdateQuest.CommandType = 1<BR> cmdUpdateQuest.CommandTimeout = 0<BR> cmdUpdateQuest.Prepared = true<BR> cmdUpdateQuest.Execute()<BR>I tryed this and it did not work ether. The page updates a table named ANSWERS then stops at this spot. If I remove this bit of code the page works fine.