My table is not updating


string connstring = configurationmanager.connectionstrings["defaultconnection"].connectionstring;              sqlconnection conn = new sqlconnection(connstring);                            string updatecommand = "update  [users] set firstnamelastname=@firstnamelastname, gender=@gender, placeofbirth=@placeofbirth, dateofbirth=@dateofbirth, educationlevel=@educationlevel, educationinstitution=@educationinstitution, employer=@employer, position=@position (username=@username))";                           sqlcommand cmd = new sqlcommand(updatecommand, conn);              cmd.parameters.addwithvalue("@firstnamelastname", txtimeprezime.text);             cmd.parameters.addwithvalue("@gender", rblpol.selectedvalue);//radio button             cmd.parameters.addwithvalue("@placeofbirth", txtmesto.text);             cmd.parameters.addwithvalue("@dateofbirth", convert.todatetime(txtdatum.text));             cmd.parameters.addwithvalue("@educationlevel", txtobrazovanie.text);             cmd.parameters.addwithvalue("@educationinstitution", txtinstitucija.text);             cmd.parameters.addwithvalue("@employer", txtvrabotenvo.text);             cmd.parameters.addwithvalue("@position", txtpozicija.text);             cmd.parameters.addwithvalue("@username", user.identity.name);              conn.open();              cmd.executenonquery();//error line             conn.close();
hi, have problem homework assignment. 
my code doesn't work when try update record. getting error '' incorrect syntax near ')' " in cmd.executenonquery() line. not updating cells, of them (those listed here).
if can tell me wrong code. 
thank much

your code ok. have redundant parenthesis in end.

instead of "))" in end of query - ")".

that's all.

 

noam b.



not forget vote answer/helpful, please. encourages you...



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

RFC_ERROR_SYSTEM_FAILURE with SAP ECC 6 Unicode

C# System.Data.Common DbCommand and getting Datasets from Oracle