locked
help me, update db .. RRS feed

  • Question

  • User-646447061 posted

    i have table item, textbox1 and button1

    item    qty

    shoes   20

    when i input number in textbox1 and click button then the qty shoes increases ..

    example, i input 5 and when i click qty shoes change into 25 >> 20 + 5 = 25 ..

    Wednesday, February 17, 2016 10:47 AM

Answers

  • User-646447061 posted

            string stra = "IF NOT EXISTS (SELECT * FROM inventory) insert into inventory (barcode,item,jumlah) values ('" + item.SelectedValue + "','" + item.SelectedItem + "','" + jumlah.Text + "') else update inventory set jumlah=jumlah + '" + jumlah.Text + "' where barcode='" + item.SelectedValue + "' and item ='" + item.SelectedItem + "'";
            SqlCommand cmda = new SqlCommand(stra, con);
            cmda.ExecuteNonQuery();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 17, 2016 12:44 PM