sql - Error c# .net Operation must use an updateable query -
error there in cmd3.executenonquery();
for(int i=0; i<listview1.items.count;i++) { string query2 = "insert orderitems(order_id,item_id,oi_quantity,unit_price) values ('"+convert.toint32(textboxid.text)+"','"+convert.toint32(this.listview1.items[i].subitems[5].text.tostring())+"','"+convert.toint32(this.listview1.items[i].subitems[3].text.tostring())+"','"+convert.toint32(this.listview1.items[i].subitems[2].text.tostring())+"')"; oledbcommand cmd2= new oledbcommand(query2,con); cmd2.executenonquery(); string query3 = "update item set stock=(select stock item id='" + convert.toint32(this.listview1.items[i].subitems[5].text.tostring()) + "') - '" + convert.toint32(this.listview1.items[i].subitems[3].text.tostring()) + "' id='" + convert.toint32(this.listview1.items[i].subitems[5].text.tostring()) + "' "; oledbcommand cmd3 = new oledbcommand(query3, con); cmd3.executenonquery(); }
you performing minus operation in update query parameters bounded in '' quotes, sql doesn't take integer.
you can store result of minus operation in variable , use variable in update query.
Comments
Post a Comment