private void btn_teacher_Click(object sender, EventArgs e)
        {
            Ad_TeacherManage childrenForm = new Ad_TeacherManage(this);

            childrenForm.Owner = this;
            this.Hide();
            childrenForm.Show();
        }
 public Ad_UpdateTeacher(Ad_TeacherManage parent, string tid, string tname, string tsex, string tdept, string title, string tsalary, string temail, string ttel)
 {
     InitializeComponent();
     pform            = parent;
     tbox_tid.Text    = tid;
     tbox_tname.Text  = tname;
     cbox_sex.Text    = tsex;
     tbox_dep.Text    = tdept;
     tbox_title.Text  = title;
     tbox_email.Text  = temail;
     tbox_tel.Text    = ttel;
     tbox_salary.Text = tsalary;
     oldtid           = tid;
 }
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string newtid  = tbox_tid.Text.Trim();
            string tname   = tbox_tname.Text.Trim();
            string tsex    = cbox_sex.Text;
            string tdept   = tbox_dep.Text.Trim();
            string title   = tbox_title.Text.Trim();
            string tsalary = tbox_salary.Text.Trim();
            string temail  = tbox_email.Text.Trim();
            string ttel    = tbox_email.Text.Trim();
            string sql     = "update teachers set tid='" + newtid + "',tname='" + tname + "',tsex='" + tsex + "',tdept='" + tdept + "',title='" + title + "',tsalary=" + int.Parse(tsalary) + ",temail='" + temail + "',ttel='" + ttel + "' where tid = '" + oldtid + "'";

            if (Ad_TeacherManage.ExecuteSql(sql) != 0)
            {
                MessageBox.Show("修改成功!");
            }
            this.pform.Show();
            this.Close();
        }
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string tid     = tbox_tid.Text.Trim();
            string tname   = tbox_tname.Text.Trim();
            string tsex    = cbox_sex.Text;
            string tdept   = tbox_dep.Text.Trim();
            string title   = tbox_title.Text.Trim();
            string tsalary = tbox_salary.Text.Trim();
            string temail  = tbox_email.Text.Trim();
            string ttel    = tbox_tel.Text.Trim();
            string ttime   = DateTime.Now.ToString();
            string sql     = "insert into teachers(tid,tname,tsex,tdept,title,tsalary,temail,ttel,ttime) values('" + tid + "','" + tname + "','" + tsex + "','" + tdept + "','" + title + "'," + int.Parse(tsalary) + ",'" + temail + "','" + ttel + "','" + ttime + "')";

            if (Ad_TeacherManage.ExecuteSql(sql) != 0)//向源数据库传递并执行SQL语句
            {
                MessageBox.Show("添加教师信息成功!");
            }
            this.pform.Show();
            this.Close();
        }
 public Ad_AddTeacher(Ad_TeacherManage parent)
 {
     InitializeComponent();
     pform = parent;
 }