if(rbtnMan.Checked) {
Sex=\男\ }
if(rbtnWomen.Checked) {
Sex=\女\ }
SqlConnection con = dataOperate.createConnection(); con.Open();
//根据班级名称查询班级编号 string classID=\ string
sql=\
classID
from
T_Class
className='\
SqlDataReader sdr=dataOperate.getRow(sql); if(sdr.Read()) {
classID=sdr[\
where
} sql
=
\
into
T_Student
values('\Address.Text+\
bool flag= dataOperate.execSQL(sql); if (flag) {
MessageBox.Show(\成功添加信息!\ ////往学生成绩表中添加学生信息 //sql =
\
into
values('\
//dataOperate.execSQL(sql); AddUser au = new AddUser(); au.Show(); this.Visible = false; } else {
31 / 55
T_Grade(Num)
MessageBox.Show(\添加信息失败!\ return; } }
private void btnReset_Click(object sender, EventArgs e) {
Reset(); }
public void Reset() {
txtBirthday.Text = \ txtAddress.Text = \ }
(六) 学生信息查询界面设计
其窗口界面如下:
窗体加载时,通过查询数据库中系部信息,将系部信息填充到系部;当系部的值发生改变时,将通过系部值查找专业信息,并填充到专业;当专业的值发生改变时,将通过专业的值查找班级信息,并填充到班级;最后通过班级值查找该班级中所有学生的信息。
实现代码如下:
private void AdminTeacherSelectInfo_Load(object sender, EventArgs e) {
string sql = \ DataSet ds = dataOperate.getDataSet(sql, \ cbDepartment.DataSource = ds.Tables[\
33 / 55
cbDepartment.DisplayMember = \ }
private void cbDepartment_SelectedIndexChanged(object sender, EventArgs e)
{
string sql = \as
m
where
departmentName='\
+
cbDepartment.Text
+
\
and
d.departmentID=m.departmentID\
DataSet ds = dataOperate.getDataSet(sql, \ cbMajor.DataSource = ds.Tables[\ cbMajor.DisplayMember = \ }
private void cbMajor_SelectedIndexChanged(object sender, EventArgs e)
{
string sql = \className from T_Major as m,T_Class as c where majorName='\