private void Button8_Click(object sender, EventArgs e) { try { m.Close(); m.Open(); SqlCommand cmd = new SqlCommand("update [dbo].[food] set Fname = '" + textBox2.Text + "', Quantity = '" + textBox3.Text + "', Type = '" + textBox4.Text + "', PRate = '" + textBox5.Text + "', SRate = '" + textBox6.Text + "' where Fid='" + textBox1.Text + "'", m); int a = cmd.ExecuteNonQuery(); if (a > 0) { MessageBox.Show("Updated"); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); this.Hide(); FoodReport f1 = new FoodReport(); f1.Show(); } else { MessageBox.Show("Invalid"); } m.Close(); } catch { MessageBox.Show("Error!!"); } }
private void Button7_Click(object sender, EventArgs e) { try { m.Close(); m.Open(); SqlCommand cmd = new SqlCommand("delete from [dbo].[food] where Fid='" + textBox1.Text + "'", m); int a = cmd.ExecuteNonQuery(); if (a > 0) { MessageBox.Show("Deleted"); textBox1.Clear(); this.Hide(); FoodReport f1 = new FoodReport(); f1.Show(); } else { MessageBox.Show("Invalid"); } m.Close(); } catch { } }
private void Button8_Click(object sender, EventArgs e) { FoodReport f1 = new FoodReport(); this.Hide(); f1.Show(); }