c# - Simple update query NOT updating. No exceptions, no errors. Just... nothing -
i trying simple update, proving difficult. don't know going on; doesn't update:
here's update code:
if(request.querystring["action"] == "update") { var inpage = request["inpage"]; var positioninpage = request["positioninpage"]; var categoryname = request["categoryname"]; var imagepath = request["imagepath"]; database.execute("update categories set positioninpage = " + positioninpage + ", inpage = " + inpage + " categoryname = '" + categoryname + "' , imagepath = '" + imagepath + "'"); response.redirect("~/fashion.cshtml"); }
here's form code:
<form method="post" action="update.cshtml?action=update"> <input type="hidden" name="categoryname" value="@request.querystring["categoryname"]" /> <input type="hidden" name="imagepath" value="@request.querystring["imagepath"]" /> <label for="inpage">move page</label> <input type="text" name="inpage" value="@request.querystring["inpage"]" style="background-color: white;" /> <br/><br/> <label for="positioninpage">position in page</label> <input type="text" name="positioninpage" value="@request.querystring["positioninpage"]" style="background-color: white;" /> <input type="submit" value="submit" style="background-color: white;" /> </form>
i have checked querystring populated when page first reached , form variables submitted upon clicking submit.
i have put db query in try catch statement , outputted exceptions, there never exceptions catch.
but still nothing updates.
what doing wrong? doing wrong here?
an update can update 0 rows. triple check clause see if trying match existing rows.
Comments
Post a Comment