Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string t_qty = "";
- SqlCommand cmd1 = new SqlCommand("select QTY from STOCK_ARRIVE where BARCODE = @barcode", d.con);
- cmd1.Parameters.AddWithValue("@barcode", txt_barcode.Text);
- d.con.Open();
- SqlDataReader dr = cmd1.ExecuteReader();
- while (dr.Read())
- {
- t_qty = dr["QTY"].ToString();
- }
- d.con.Close();
- try
- {
- int less = 0;
- less = int.Parse(t_qty) - int.Parse(txt_qty.Text);
- SqlCommand cmd2 = new SqlCommand("update STOCK_ARRIVE set QTY=@pq where BARCODE=@barcode AND S_VC=@vc", d.con);
- cmd2.Parameters.AddWithValue("@pq", less);
- cmd2.Parameters.AddWithValue("@barcode", txt_barcode.Text);
- cmd2.Parameters.AddWithValue("@vc", txt_vc.Text);
- d.con.Open();
- cmd2.ExecuteNonQuery();
- d.con.Close();
- }
- catch (Exception ex)
- {
- Response.Write(ex);
- }
- Response.Write("<script>alert('Data has been saved')</script>");
Add Comment
Please, Sign In to add comment