private void btnSave_Click(object sender, EventArgs e) { ms.AddPR(int.Parse(txtPEId.Text), int.Parse(txtQuantity.Text)); purchaseReturnBindingSource.DataSource = cmd.Purchase_Return.ToList(); Product_Order p = new Product_Order(); using (cmd) { p = cmd.Product_Order.Where(x => x.PONo.ToString().Equals(txtPONo.Text)).FirstOrDefault(); p.Quabtity = p.Quabtity - (int.Parse(txtQuantity.Text)); cmd.Entry(p).State = EntityState.Modified; cmd.SaveChanges(); } MessageBox.Show("Succesfully Return"); txtQuantity.Clear(); load(); }