c# - Syntax error while trying to update some column of a table -
i have written c# code update column of table of sql server. name of table "finalfee". when trying execute code showing syntax error. why happening?
sqlconnection con23 = new sqlconnection(configurationmanager.connectionstrings["connectionstring"].connectionstring); con23.open(); sqlcommand cmd10 = new sqlcommand("update finalfee set amountpaid='" + t26 + "',discountamount='" + t30 + "',grandamount='" + t27 + "',balanceamount='"+t28+"' admno='"+textbox56.text+"')", con23); cmd10.executenonquery();
remove last ')' in command.
sqlcommand cmd10 = new sqlcommand("update finalfee set amountpaid='" + t26 + "',discountamount='" + t30 + "',grandamount='" + t27 + "',balanceamount='"+t28+"' admno='"+textbox56.text+"'", con23);
you should using parameters.
edit:
remove ')' here: admno='"+textbox56.text+"')"
Comments
Post a Comment