Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (kiemtradulieu() == false)
            {
                return;
            }
            else
            {
                using (SqlConnection con = new SqlConnection(strcon))

                    using (SqlCommand cmd = new SqlCommand())
                    {
                        con.Open();
                        cmd.Connection  = con;
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.CommandText = "themmon";
                        cmd.Parameters.AddWithValue("@malop", txtMAM.Text);
                        cmd.Parameters.AddWithValue("@tenmon", cbbtenmon11.SelectedValue);
                        cmd.Parameters.AddWithValue("@tengiangvien", cbbGV.SelectedValue);
                        cmd.Parameters.AddWithValue("@tenki", cbbkyhoc.Text);
                        cmd.Parameters.AddWithValue("@namhoc", txtNamhoc.Text);
                        int i = cmd.ExecuteNonQuery();
                        if (i > 0)
                        {
                            MessageBox.Show("Thông báo", "Thêm Thành Công");
                            FormLTC f = new FormLTC();
                            f.loadmon();
                            this.Close();
                        }

                        else
                        {
                            MessageBox.Show("Thông báo", "Thêm Không Thành Công");
                        }
                    }
            }
        }
Exemple #2
0
        private void themlop_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormLTC f = new FormLTC();

            f.loadmon();
        }