private void Button8_Click(object sender, EventArgs e)
        {
            try
            {
                m.Close();
                m.Open();
                SqlCommand cmd = new SqlCommand("update [dbo].[transaction] set TRname = '" + textBox2.Text + "', TRType = '" + textBox3.Text + "', Price = '" + textBox4.Text + "', Description = '" + textBox5.Text + "', Date = '" + textBox6.Text + "'  where TRid='" + 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();
                    TransactionReport f1 = new TransactionReport();
                    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].[transaction] where TRid='" + textBox1.Text + "'", m);
                int        a   = cmd.ExecuteNonQuery();
                if (a > 0)
                {
                    MessageBox.Show("Deleted");
                    textBox1.Clear();
                    textBox2.Clear();
                    textBox3.Clear();
                    textBox4.Clear();
                    textBox5.Clear();
                    textBox6.Clear();


                    this.Hide();
                    TransactionReport f1 = new TransactionReport();
                    f1.Show();
                }
                else
                {
                    MessageBox.Show("Invalid");
                }
                m.Close();
            }
            catch
            {
            }
        }
Exemple #3
0
        private void Button13_Click(object sender, EventArgs e)
        {
            TransactionReport t1 = new TransactionReport();

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