c# - failure in Update of sql table data -
i trying update users details if user want edit his/her information on our system use following code couldn't able it. there no error or exception occur, add watch , code smoothly execute.
public void updateprofile() { sqlconnection mysql = new sqlconnection(configurationmanager.connectionstrings["blooddonorregistrationconnectionstring"].tostring()); sqlcommand cmd = new sqlcommand("update donor set d_firstname= @fn, d_lastname=@ln, d_phone=@phn, d_city=@ct, d_address=@add d_email='"+session["userid"]+"'", mysql); cmd.commandtype = commandtype.text; cmd.parameters.addwithvalue("@fn", textboxfname.text); cmd.parameters.addwithvalue("@ln", textboxlname.text); cmd.parameters.addwithvalue("@phn", textboxcellnum.text); cmd.parameters.addwithvalue("@ct", dropdownlistcity.selecteditem.text); cmd.parameters.addwithvalue("@add", buttonaddress.text); mysql.open(); cmd.executenonquery(); mysql.close(); response.redirect("dodashboard.aspx"); }
please guide , in advance.
session["userid"]
object, think d_email column in database of varchar type try using session["userid"].tostring()
while using in clause.it work....
Comments
Post a Comment