c# - Not able to insert. Doesn't show any errors but doesn't insert as well -
this insert statement. records not inserting no errors showing also. please help
protected void btn_add_click(object sender, eventargs e) { if (btn_add.text == "submit") { string height = txtheight.text; string topdia = convert.tostring(txttopdiameter.text); string bottomdia = convert.tostring(txtbottomdiameter.text); string shaftthick = convert.tostring(txtshaftthick.text); string blackwt = convert.tostring(txtblackweight.text); string totmanhrperpole = convert.tostring(txttotmanhrpoledata.text); string plate_length = convert.tostring(txtplatelength.text); string plate_dia = convert.tostring(txtplatedia.text); string plate_thickness = convert.tostring(txtplatethick.text); system.collections.hashtable ht = (system.collections.hashtable)session["userdetails"]; int64 usrid = (int64)ht["userid"]; string createdby = convert.tostring(usrid); string foundboltid = convert.tostring(ddlfoundationbolt.selectedvalue); string poletypeid = convert.tostring(ddlpoltype.selectedvalue); string producttypeid = convert.tostring(ddlpdttype.selectedvalue); string status = chkactive.checked ? "true" : "false"; string filename = path.getfilename(fileuploadimages.postedfile.filename); fileuploadimages.saveas(server.mappath("~/images/pole data/" + filename)); try { sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["valmont"].tostring()); con.open(); sqlcommand cmd = new sqlcommand("insert def_pole_data_mst(height,topdia,bottomdia,shaftthick,blackwt,totmanhrperpole,plate_length,plate_dia,plate_thickness,createdby,foundboltid,poletypeid,producttypeid,status,imagepath) values(@height,@topdia,@bottomdia,@shaftthick,@blackwt,@totmanhrperpole,@plate_length,@plate_dia,@plate_thickness,@createdby,@foundboltid,@poletypeid,@producttypeid,@status,@imagepath)", con); cmd.parameters.addwithvalue("@height", height); cmd.parameters.addwithvalue("@topdia", topdia); cmd.parameters.addwithvalue("@bottomdia", bottomdia); cmd.parameters.addwithvalue("@shaftthick", shaftthick); cmd.parameters.addwithvalue("@blackwt", blackwt); cmd.parameters.addwithvalue("@totmanhrperpole", totmanhrperpole); cmd.parameters.addwithvalue("@plate_length", plate_length); cmd.parameters.addwithvalue("@plate_dia", plate_dia); cmd.parameters.addwithvalue("@plate_thickness", plate_thickness); cmd.parameters.addwithvalue("@createdby", createdby); cmd.parameters.addwithvalue("@foundboltid", foundboltid); cmd.parameters.addwithvalue("@poletypeid", poletypeid); cmd.parameters.addwithvalue("@producttypeid", producttypeid); cmd.parameters.addwithvalue("@status", status); cmd.parameters.addwithvalue("@imagepath", "~/images/pole data/" + filename); cmd.executenonquery(); con.close(); bindgrid(); accordian.selectedindex = 1; jquerydisplay.showalertmessage("record inserted successfully"); clerafields(); } catch (exception ex) { jquerydisplay.showalertmessage(ex.message); } { } }
here's table:
Comments
Post a Comment