コード例 #1
0
        public UpdateStuInfo(string id)
        {
            InitializeComponent();
            setMajorData();
            student stu = new student();

            stu.StuId = id;
            DataSet   ds        = DAO_Student.SelectStuData(stu);
            DataTable dataTable = ds.Tables["student"];

            tb_stuId.Text    = id;
            tb_stuName.Text  = dataTable.Rows[0][1].ToString();
            cb_stuGrade.Text = dataTable.Rows[0][3].ToString();
            cb_stuMajor.Text = dataTable.Rows[0][4].ToString();
            tb_stuHome.Text  = dataTable.Rows[0][6].ToString();
            tb_stuClass.Text = dataTable.Rows[0][5].ToString();
            if (dataTable.Rows[0][2].ToString() == "女")
            {
                this.sex_gird.Checked = true;
            }
            else
            {
                this.sex_boy.Checked = true;
            }
        }
コード例 #2
0
        //设置学生表格数据
        private void selectStuData()
        {
            student student = new student();
            DataSet dataSet = DAO_Student.SelectStuData(student);

            dgv_stuInfo.DataSource = dataSet.Tables["student"];
        }
コード例 #3
0
        //设置选择班级下拉框数据
        private void setClassData()
        {
            student student = new student();

            DataSet   ds      = DAO_Student.SelectStuData(student);
            DataTable dtGroup = ds.Tables["student"];

            cb_className.DataSource    = dtGroup;
            cb_className.DisplayMember = "stuClassName";
            cb_className.ValueMember   = "stuClassName";
        }
コード例 #4
0
        //修改学生按钮点击事件
        private void bt_change_Click(object sender, EventArgs e)
        {
            student       stu           = new student();
            string        id            = dgv_stuInfo.SelectedRows[0].Cells[0].Value.ToString();
            UpdateStuInfo changeStuInfo = new UpdateStuInfo(id);

            changeStuInfo.ShowDialog();
            DataSet   ds      = DAO_Student.SelectStuData(stu);
            DataTable dtGroup = ds.Tables["student"];

            dgv_stuInfo.DataSource = dtGroup;
        }
コード例 #5
0
        //查询按钮点击事件
        private void bt_select_Click(object sender, EventArgs e)
        {
            student stu = new student();

            if (tb_stuId.Text.Trim().Length != 0)
            {
                stu.StuId = tb_stuId.Text;
            }
            if (tb_stuName.Text.Trim().Length != 0)
            {
                stu.StuName = tb_stuName.Text;
            }
            if (cb_stuSex.SelectedIndex != -1)
            {
                stu.StuSex = cb_stuSex.SelectedItem.ToString();
            }
            stu.StuMajor     = cb_major.SelectedValue.ToString();
            stu.StuClassName = cb_className.SelectedValue.ToString();
            DataSet   ds      = DAO_Student.SelectStuData(stu);
            DataTable dtGroup = ds.Tables["student"];

            dgv_stuInfo.DataSource = dtGroup;
        }