Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*if (txtMGV.Text == "")
             * {
             *  SqlConnection cnn1 = new SqlConnection(str);
             *  string sql2 = "delete from ThongTinMuon where MaMuon=@mm";
             *  SqlCommand cmd = new SqlCommand(sql2, cnn1);
             *  cmd.Parameters.AddWithValue("mm", txtMM.Text);
             *
             *  cmd.ExecuteNonQuery();
             * }*/

            try
            {
                {
                    SqlConnection cnn = new SqlConnection(str);
                    cnn.Open();
                    string     sql1    = "insert into GiaoVien values(@magv,@tengv,@mm,@sdt)";
                    SqlCommand command = new SqlCommand(sql1, cnn);
                    command.Parameters.AddWithValue("magv", txtMGV.Text);
                    command.Parameters.AddWithValue("tengv", txtTGV.Text);
                    command.Parameters.AddWithValue("mm", txtMM.Text);
                    command.Parameters.AddWithValue("sdt", txtSDT.Text);
                    command.ExecuteNonQuery();
                    FormTPM ftb = new FormTPM();
                    this.Hide();
                    ftb.Show();
                }
            }
            catch
            {
                MessageBox.Show("Mã giáo viên " + txtMGV + " đã tồn tại");
            }
        }
Ejemplo n.º 2
0
        private void tạoPhiếuMượnThiếtBịToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTPM f1 = new FormTPM();

            this.Close();
            f1.Show();
        }