学生学籍管理系统的设计与实现 下载本文

} }

else if (btnBrowse.Text == \修改\ {

//加载班级信息

string sql = \

DataSet ds = dataOperate.getDataSet(sql, \ cbDepartment.DataSource = ds.Tables[\ cbDepartment.DisplayMember = \

btnBrowse.Text = \保存\ txtName.Enabled = true; rbtnMan.Enabled = true; rbtnWomen.Enabled = true; txtBirthday.Enabled = true; txtAddress.Enabled = true; cbDepartment.Enabled = true; cbMajor.Enabled = true;

cbClass.Enabled = true; }

else//保存信息 {

string Sex = \ string classID = \ if (rbtnMan.Checked) {

Sex=\男\ } else {

Sex=\女\ } string sql1

=

\

*

from

T_Class

className='\

SqlDataReader sdr = dataOperate.getRow(sql1); try

41 / 55

where

{

sdr.Read();

classID = sdr[\ }

catch(Exception ee) {

MessageBox.Show(ee.Message); } string

sql2

=

\

T_Student

set

Name='\='\

bool flag = dataOperate.execSQL(sql2); if (flag) {

MessageBox.Show(\修改成功!\ btnBrowse.Text = \查询\ txtName1.Enabled = false; rbtnMan.Enabled = false;

rbtnWomen.Enabled = false; txtBirthday.Enabled = false; txtAddress.Enabled = false; cbDepartment.Enabled = true; cbMajor.Enabled = true; cbClass.Enabled = false; Empty(); } } }

public void Empty() {

txtName1.Text = \ txtBirthday.Text = \ txtAddress.Text = \ }

private void cbDepartment_SelectedIndexChanged(object 43 / 55

sender,

EventArgs e)

{

string sql = \departmentID from T_Department where departmentName='\

SqlDataReader sdr = dataOperate.getRow(sql); if (sdr.Read()) {

string departmentID = sdr[\ //根据系部编号查询专业信息

sql = \* from T_Major where departmentID='\+ departmentID + \

DataSet ds = dataOperate.getDataSet(sql, \ cbMajor.DataSource = ds.Tables[\ cbMajor.DisplayMember = \ } }

private void cbMajor_SelectedIndexChanged(object sender, EventArgs