update records in the database by checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sukaina
    New Member
    • Sep 2006
    • 4

    update records in the database by checkbox

    hello

    i want to update some records in the database by using checkboxes.
    I wrote a code but it didn't work proparly. It update whole records not only the selected one by the checkbox. how can i do that????
    this is my code

    While ((Repeat1__numR ows <> 0) AND (NOT rsAnswer2.EOF))
    %>
    <tr valign="baselin e">
    <td nowrap align="right"></td>
    <td valign="top">
    <input type="checkbox" name="answers" value="<%=(rsAn swer2.Fields.It em("answer_no") .Value)%>" >
    <option value="<%=(rsAn swer2.Fields.It em("answer_no") .Value)%>"><%=( rsAnswer2.Field s.Item("answers ").Value)%> </option> &nbsp; &nbsp;&nbsp;&nb sp; </td>
    <td valign="top"><% =(rsAnswer2.Fie lds.Item("count s").Value)%> </td>
    </tr>
    <%
    Repeat1__index= Repeat1__index+ 1
    Repeat1__numRow s=Repeat1__numR ows-1
    rsAnswer2.MoveN ext()
    Wend
    %>
    update page:
    <%


    set cmdUpdateAns = Server.CreateOb ject("ADODB.Com mand")
    cmdUpdateAns.Ac tiveConnection = MM_srcsurvey_co nn_STRING
    cmdUpdateAns.Co mmandText = "UPDATE answers SET counts = counts + 1 WHERE answer_no= " & request.queryst ring("answers")
    cmdUpdateAns.Co mmandType = 1
    cmdUpdateAns.Co mmandTimeout = 0
    cmdUpdateAns.Pr epared = true
    cmdUpdateAns.Ex ecute()


    %>
Working...