1、 《c#程序设计》大作业 题目:学生成绩管理系统 班级: 学号: 姓名: 小组组员分工: 姓名 分工 汪依清: StuIfoupdate Login 傅勤珍: Other Rank 斯王春:
2、 StuIfoSearch Mainframe 黄成烽: StuIfoChange CourseEnter 吴凯: StuoIfoEnter ScoreEnter 朱隆震: CurChoice ScoreUpdate 洪彬: Othe
3、r2 学生成绩管理系统 ------主界面设计和学生信息查询 主界面设计: 主界面设计要求简单明了,能把系统全部功效展现在主界面上面,能让人方便查询学生多种信息,包含系统管理、学生信息管理、课程信息管理、成绩信息管理、选课信息管理、特殊情况管理等功效,不仅如此,界面设计也要美观大方,这么很好实现了人机交互。 学生信息查询: 1.1功效 (1) 依据查询条件实现学生信息查询 (2) 学生选课信息查询、成绩信息查询 (3) 学生信息、课程信息、成绩信息增加、删除、修改 (4) 对基础信息完成增加、删除、修改时,需注
4、意表和表之间关联 1.2功效需求分析 学生信息查询:学生能够依据学号、姓名、专业进行查询. 1.3软件环境需求 利用Visual Studio 作为前台开发工具,后台SQL数据库管理实现学生成绩管理系统。设计 2.1学生信息查询模块 学生信息查询:学生能够依据学号、姓名、班级、学院进行查询。 学生信息查询 班级查询 学院查询 姓名查询 学号查询 2.2学生信息内容 学生信息包含学号,姓名,性别,民族,班级,院系,出生日期,政治面貌。 学 生 信 息 性别 学号 姓名 政治面貌
5、 出生日期 院系 班级 民族 3.数据库设计 本系统数据库是SQL server数据库,在SQL环境下创建数据库学生管理系统文件。依据以上模块划分图分析,针对学生信息管理系统,分别对个人基础信息、选课、成绩进行具体研究分析。数据库设计采取一库多表式设计。即设计了一个用户登录,添加学生信息,数据库中对学生信息加入基础添加、查询、修改和删除。该数据库包含Student、Score、Other、Course、Choice、User列表。本人负责部分为后用户信息“Student”表。 以下是数据库表清单: User表: Stu
6、dent表: Score表: Other表: Course表: Choice表: 4. 测试: 主界面: 学生信息查询: 关键功效代码: Mainframe代码: namespace StudentIfoMag { public partial class MainFrm : Form { public MainFrm() { InitializeComponent(); }
7、 private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); } private void 学生信息录入ToolStripMenuItem_Click(object sender, EventArgs e) { StuIfoEnter ent = new StuIfoEnter(); ent.MdiParent = this;
8、 ent.Show(); tssStu.Text = ent.Text; } private void 学生信息更新ToolStripMenuItem_Click(object sender, EventArgs e) { StuIfoSearch ser = new StuIfoSearch(); ser.MdiParent = this; ser.Show(); tssStu .Text
9、 ser.Text; } private void 学生信息更新ToolStripMenuItem1_Click(object sender, EventArgs e) { StuIfoUpdate upt = new StuIfoUpdate(); upt.MdiParent = this; upt.Show(); tssStu.Text = upt.Text; } private void
10、 课程信息录入ToolStripMenuItem_Click(object sender, EventArgs e) { CourseEnter en = new CourseEnter(); en.MdiParent = this; en.Show(); tssStu.Text = en.Text; } private void 成绩录入ToolStripMenuItem_Click(object sender, EventArgs
11、 e) { ScoreEnter enter = new ScoreEnter(); enter.MdiParent = this; enter.Show () ; tssStu.Text = enter.Text; } private void 成绩更新ToolStripMenuItem_Click(object sender, EventArgs e) { ScoreUpdate up
12、 new ScoreUpdate(); up.MdiParent = this; up.Show(); tssStu.Text = up.Text; } private void 成绩排名ToolStripMenuItem_Click(object sender, EventArgs e) { Rank ra = new Rank(); ra.MdiParent = this; r
13、a.Show(); tssStu.Text = ra.Text; } private void 班级选课ToolStripMenuItem_Click(object sender, EventArgs e) { CurChoice ch = new CurChoice(); ch.MdiParent = this; ch.Show(); tssStu.Text = ch.Text; }
14、 private void 留级休学ToolStripMenuItem_Click(object sender, EventArgs e) { Other oth = new Other(); oth.MdiParent = this; oth.Show(); tssStu.Text = oth.Text; } private void 留级ToolStripMenuItem_Click(object sender,
15、EventArgs e) { Other2 the = new Other2(); the.MdiParent = this; the.Show(); tssStu.Text = the.Text; } } } 学生信息查询代码: namespace StudentIfoMag { public partial class StuIfoSearch : Form { public
16、StuIfoSearch() { InitializeComponent(); } private void StuIfoSearch_Load(object sender, EventArgs e) { comboBox1.SelectedIndex = 0; // TODO: 这行代码将数据加载到表“studentIfoMagDataSet.Student”中。您能够依据需要移动或移除它。 // this.stud
17、entTableAdapter.Fill(this.studentIfoMagDataSet.Student); } private void button1_Click(object sender, EventArgs e) { string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=E:\汪依清014574\大三\C#\STUDENTINFORMATIONMAG\StudentIfoMag.mdf;Integrated Securi
18、ty=True;Connect Timeout=30;User Instance=True"; SqlConnection connection = new SqlConnection(connString); if (textBox1.Text == "") //未输入查询条件时显示全部内容 { string sql = String.Format("select * from Student"); //SQL语句 try
19、 { connection.Open(); //打开数据库连接 SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); DataSet DS = new DataSet(); adapter.Fill(DS, "Student"); dataGridView1.DataSource = DS.Tables
20、["Student"]; } catch (SqlException ex) //数据库犯错情况 { MessageBox.Show(ex.Message, "操作数据库犯错!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connect
21、ion.Close(); //关闭数据库情况 } } else //输入了查询条件 { string sql; switch (comboBox1.SelectedItem.ToString()) { case "学号": sql = String.Format("select *
22、 from Student where studentNo = '{0}' ", textBox1.Text); try { connection.Open(); //打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapte
23、r(sql, connection); adapter.Fill(DS, "Student"); dataGridView1.DataSource = DS.Tables["Student"]; if (DS.Tables[0].Rows.Count == 0) //假如未查询到任何信息,给出提醒,并显示全部信息 {
24、 MessageBox.Show("没有查到相关信息,请检验查询条件!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (SqlException ex) //数据库犯错情况 { MessageBox.Show(ex.Mes
25、sage, "操作数据库犯错!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); //关闭数据库连接 } break; case "姓名":
26、 sql = String.Format("select * from Student where convert(nvarchar(255),studentName) LIKE '%{0}%' ", textBox1.Text); try { connection.Open(); //打开数据库连接 DataSet DS =
27、 new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); adapter.Fill(DS, "Student"); dataGridView1.DataSource = DS.Tables["Student"]; if (DS.Tables[0].Rows.Count
28、 0) //假如未查询到任何信息,给出提醒,并显示全部信息 { MessageBox.Show("没有查到相关信息,请检验查询条件!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (SqlException ex) /
29、/数据库犯错情况 { MessageBox.Show(ex.Message, "操作数据库犯错!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); //关闭数据库连接
30、 } break; case "班级": sql = String.Format("select * from Student where convert(nvarchar(255),studentClass) = '{0}' ", textBox1.Text); try {
31、 connection.Open(); //打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); adapter.Fill(DS, "Student"); dataGridView1.DataSourc
32、e = DS.Tables["Student"]; if (DS.Tables[0].Rows.Count == 0) //假如未查询到任何信息,给出提醒,并显示全部信息 { MessageBox.Show("没有查到相关信息,请检验查询条件!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
33、 } } catch (SqlException ex) //数据库犯错情况 { MessageBox.Show(ex.Message, "操作数据库犯错!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally
34、 { connection.Close(); //关闭数据库连接 } break; case "学院": sql = String.Format("select * from Student where convert(nvarchar(255),studentAcademy) LIKE '%{0}%' ",
35、 textBox1.Text); try { connection.Open(); //打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
36、 adapter.Fill(DS, "Student"); dataGridView1.DataSource = DS.Tables["Student"]; if (DS.Tables[0].Rows.Count == 0) //假如未查询到任何信息,给出提醒,并显示全部信息 { MessageBox.Show("没有查到相关信息,请检验查
37、询条件!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (SqlException ex) //数据库犯错情况 { MessageBox.Show(ex.Message, "操作数据库犯错!", MessageBoxButtons.OK,
38、MessageBoxIcon.Error); } finally { connection.Close(); //关闭数据库连接 } break; } } } private void bu
39、tton3_Click(object sender, EventArgs e) { this.Close(); } private void button2_Click(object sender, EventArgs e) { string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=E:\汪依清014574\大三\C#\STUDENTINFORMATIONMAG\StudentIfoMag.md
40、f;Integrated Security=True;Connect Timeout=30;User Instance=True"; SqlConnection connection = new SqlConnection(connString); string sql = String.Format("select * from Student"); //SQL语句 connection.Open(); //打开数据库连接 SqlDataAdapter adapter = new S
41、qlDataAdapter(sql, connection); DataSet DS = new DataSet(); adapter.Fill(DS, "Student"); dataGridView1.DataSource = DS.Tables["Student"]; studentTableAdapter.Fill(studentIfoMagDataSet.Student); } } } 5.总结 此次系统设计让我知道了进行管理系统开发这么工作,要有恒心,要能静下新来做,而不能浮躁。要真真实实多查资料,多问,多看。要善于同同学和老师交流和合作,善于获取多种有用资源。 更让我认识到一个系统开发过程中编码不是关键,最关键是分析系统、建立起系统模型。只有分析出来才能进行编码。在分析一个系统前,操作者必需要对将要开发系统所包含到各方面知识有一个整体认识,然后将系统模型建立起来。 在程序编写中,我认识到软件要有简便界面,良好程序风格。拥有这些条件,程序可读性才会好,开发复杂度才能大大降低,修改代码时愈加轻易下手。






