private void btn_stu_Click(object sender, EventArgs e)
        {
            Ad_StuManage childrenForm = new Ad_StuManage(this);

            childrenForm.Owner = this;
            this.Hide();
            childrenForm.Show();
        }
Beispiel #2
0
        public Ad_AddStudent(Ad_StuManage parent)
        {
            InitializeComponent();
            pform = parent;

            string sql1 = "select distinct sgrade from students";

            if (Ad_StuManage.ExecuteSql(sql1) != 0)
            {
                this.cbox_grade.DataSource = Ad_StuManage.Query(sql1).Tables["students"];
                cbox_grade.DisplayMember   = "sgrade";
            }
        }
Beispiel #3
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string newsid = tbox_sid.Text.Trim();
            string sname  = tbox_sname.Text.Trim();
            string ssex   = cbox_sex.Text;
            string sgrade = cbox_grade.Text;
            string sdept  = tbox_major.Text.Trim();
            string syear  = cbox_year.Text;
            string sage   = tbox_sage.Text.Trim();
            string sql    = "update students set sid = '" + newsid + "',sname='" + sname + "',ssex='" + ssex + "',sgrade='" + sgrade + "',sdept='" + sdept + "',syear='" + syear + "',sage=" + int.Parse(sage) + " where sid = '" + oldsid + "'";

            if (Ad_StuManage.ExecuteSql(sql) != 0)
            {
                MessageBox.Show("修改成功!");
            }

            this.pform.Show();
            this.Close();
        }
Beispiel #4
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string sid    = tbox_sid.Text.Trim();
            string sname  = tbox_sname.Text.Trim();
            string ssex   = cbox_sex.Text;
            string sgrade = cbox_grade.Text;
            string sdept  = tbox_major.Text.Trim();
            string syear  = cbox_year.Text;
            string sage   = tbox_sage.Text.Trim();
            string stime  = DateTime.Now.ToString();
            string sql    = "insert into students(sid,sname,ssex,sgrade,sdept,syear,sage,stime) values('" + sid + "','" + sname + "','" + ssex + "','" + sgrade + "','" + sdept + "','" + syear + "'," + int.Parse(sage) + ",'" + stime + "')";

            if (Ad_StuManage.ExecuteSql(sql) != 0)//向源数据库传递并执行SQL语句
            {
                MessageBox.Show("添加学生信息成功!");
            }
            this.pform.Show();
            this.Close();
        }
Beispiel #5
0
        public Ad_UpdateStudent(Ad_StuManage parent, string sid, string sname, string ssex, string sgrade, string sdept, string syear, string sage)
        {
            InitializeComponent();
            pform           = parent;
            tbox_sid.Text   = sid;
            tbox_sname.Text = sname;
            cbox_sex.Text   = ssex;
            cbox_grade.Text = sgrade;
            tbox_major.Text = sdept;
            cbox_year.Text  = syear;
            tbox_sage.Text  = sage;
            oldsid          = sid;

            string sql1 = "select distinct sgrade from students";

            if (Ad_StuManage.ExecuteSql(sql1) != 0)
            {
                this.cbox_grade.DataSource = Ad_StuManage.Query(sql1).Tables["students"];
                cbox_grade.DisplayMember   = "sgrade";
            }
        }