private void button3_Click(object sender, EventArgs e) { try { EquipmentServices catService = new EquipmentServices(); Food f = catService.GetById(id); f.Id = id; f.Name = textBox5.Text; f.Cost = Convert.ToDouble(textBox4.Text); int result = catService.update(f); if (result > 0) { MessageBox.Show("Food updated."); UpdateGridView(); } else { MessageBox.Show("Error"); } } catch (Exception) { MessageBox.Show("Error!"); } }