private void Button8_Click(object sender, EventArgs e)
        {
            try
            {
                m.Close();
                m.Open();
                SqlCommand cmd = new SqlCommand("update [dbo].[fertilizer] set FrName = '" + textBox2.Text + "', Rate = '" + textBox3.Text + "', Quantity = '" + textBox4.Text + "' where Frid='" + textBox1.Text + "'", m);
                int        a   = cmd.ExecuteNonQuery();
                if (a > 0)
                {
                    MessageBox.Show("Updated");
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox3.Clear();
                    textBox4.Clear();


                    this.Hide();
                    FertilierReport f1 = new FertilierReport();
                    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].[fertilizer] where Frid='" + textBox1.Text + "'", m);
                int        a   = cmd.ExecuteNonQuery();
                if (a > 0)
                {
                    MessageBox.Show("Deleted");
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox3.Clear();
                    textBox4.Clear();

                    this.Hide();
                    FertilierReport f1 = new FertilierReport();
                    f1.Show();
                }
                else
                {
                    MessageBox.Show("Invalid");
                }
                m.Close();
            }
            catch
            {
            }
        }
Пример #3
0
        private void Button9_Click(object sender, EventArgs e)
        {
            FertilierReport fr1 = new FertilierReport();

            this.Hide();
            fr1.Show();
        }