sql server - Why is the same value being saved into my table regardless of which select option I select? -


i'm adding row/record table; 1 of values saved, supposed represent of 2 options selected select element, saved "0" - whether select first option (at index 0) or second option (at index 1).

here code:

dim subcategory string  . . . if request.form.item("action") = "save"     unit = request.form.item("unit")     custno = request.form.item("custno")     subcategory = request.form.item("selectsubcategory").tostring() . .  dim query2 string = string.empty query2 &= "update customers " query2 &= "set subcategory = @subcat " query2 &= "where memberno = @memberno , unit = @unit , custno = @custno "  using conn new sqlconnection("server=prosql05;database=cpsdata;uid=sa;pwd=sqlsql")     using comm new sqlcommand()         comm             .connection = conn             .commandtype = commandtype.text             .commandtext = query2             .parameters.add("@memberno", sqldbtype.nvarchar).value = memberno             .parameters.add("@unit", sqldbtype.nvarchar).value = unit             .parameters.add("@custno", sqldbtype.nvarchar).value = custno             .parameters.add("@subcat", sqldbtype.nvarchar).value = subcategory         end         conn.open()         comm.executenonquery()     end using 'comm end using 'conn            . . . <select name="selectsubcategory" color="<%=session("textcolor")%>" style="font: 8pt arial" onchange="updateflag=true;">     <% if not isnewbusiness then%>         <option <% if subcategory = "0" response.write(" selected")%> value="0">existing         <option <% if subcategory = "1" response.write(" selected")%> value="1">organic growth     <% else%>         <option <% if subcategory = "0" response.write(" selected")%> value="0">new         <option <% if subcategory = "1" response.write(" selected")%> value="1">assumed     <% end if%> </select> 

unit , custno being stored enter them (string values in text boxes), subcategory 0.

in test scenario, existing , organic growth 2 options display in "selectsubcategory" select element. whether choose "organic growth" or "existing", 0 written database.

why? doing wrong?


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -