sql server - Deleting Specific Data From Database Row (C#) -


i'm trying allow (a user), delete data database , replace updated information.

the problem run this:

sqlexception unhandled: incorrect syntax near ','.

and error appears @ first: sqlcmd.executenonquery()

here full code "apply edits" button:

private void applybtn_click(object sender, eventargs e) {         connection();         sqlconnection.open();          sqlcmd = new sqlcommand("delete item, quantity, description, datasheet inventory_table id= " + id, sqlconnection);         sqlcmd.executenonquery();          sqlcmd = new sqlcommand("update inventory_table set item = @item, quantity = @quantity, description = @description, datasheet = @datasheet "+             "where id= " + id, sqlconnection);         sqlcmd.parameters.addwithvalue("@item", this.txtbx1.text);         sqlcmd.parameters.addwithvalue("@quantity", this.txtbx2.text);         sqlcmd.parameters.addwithvalue("@description", this.txtbx3.text);         sqlcmd.parameters.addwithvalue("@datasheet", this.txtbx4.text);         sqlcmd.executenonquery();          sqlconnection.close();         } 

try

private void applybtn_click(object sender, eventargs e) {         connection();         sqlconnection.open();          sqlcmd = new sqlcommand("delete inventory_table id= " + id, sqlconnection);         sqlcmd.executenonquery();          sqlcmd = new sqlcommand("update inventory_table set item = @item, quantity = @quantity, description = @description, datasheet = @datasheet "+             "where id= " + id, sqlconnection);         sqlcmd.parameters.addwithvalue("@item", this.txtbx1.text);         sqlcmd.parameters.addwithvalue("@quantity", this.txtbx2.text);         sqlcmd.parameters.addwithvalue("@description", this.txtbx3.text);         sqlcmd.parameters.addwithvalue("@datasheet", this.txtbx4.text);         sqlcmd.executenonquery();          sqlconnection.close();         } 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -