1、C#大作业学生成绩管理系统C#大作业学生成绩管理系统 作者: 日期: c#程序设计大作业 题目:学生成绩管理系统 班级: 学号: 姓名: 小组成员分工:姓名分工汪依清: StuIfoupdate Login傅勤珍: Other Rank斯王春: StuIfoSearch Mainframe黄成烽: StuIfoChange CourseEnter吴凯: StuoIfoEnter ScoreEnter朱隆震: CurChoice ScoreUpdate洪彬: Other2 学生成绩管理系统-主界面的设计和学生信息查询主界面的设计: 主界面设计要求简单明了,能把系统的所有功能展现在主界面上面,能让
2、人方便的查询学生的各种信息,包括系统管理、学生信息管理、课程信息管理、成绩信息管理、选课信息管理、特殊情况管理等功能,不仅如此,界面的设计也要美观大方,这样很好的实现了人机交互。学生信息查询:1.1功能(1) 根据查询条件实现学生信息的查询(2) 学生选课信息查询、成绩信息的查询(3) 学生信息、课程信息、成绩信息的增加、删除、修改(4) 对基本信息完成增加、删除、修改时,需注意表与表之间的关联1.2功能需求分析 学生信息查询:学生可以根据学号、姓名、专业进行查询.1.3软件环境需求利用Visual Studio 2010作为前台开发工具,后台SQL数据库管理实现学生成绩管理系统。设计2.1学
3、生信息查询模块学生信息查询:学生可以根据学号、姓名、班级、学院进行查询。 学生信息查询班级查询学院查询姓名查询学号查询2.2学生信息内容学生的信息包括学号,姓名,性别,民族,班级,院系,出生日期,政治面貌。学 生 信 息性别学号姓名政治面貌出生日期院系班级民族 3.数据库设计 本系统的数据库是SQL server数据库,在SQL环境下创建数据库学生管理系统文件。根据以上模块划分图分析,针对学生信息管理系统,分别对个人基本信息、选课、成绩进行详细的研究分析。数据库的设计采用一库多表式设计。即设计了一个用户登录,添加学生信息,数据库中对学生的信息加入基础的添加、查询、修改和删除。该数据库包括Stu
4、dent、Score、Other、Course、Choice、User列表。本人负责部分为后用户信息“Student”表。以下是数据库的表清单:User表:Student表:Score表:Other表:Course表:Choice表:4.测试:主界面:学生信息查询:主要功能代码:Mainframe代码:namespace StudentIfoMag public partial class MainFrm : Form public MainFrm() InitializeComponent(); private void 退出ToolStripMenuItem_Click(object se
5、nder, EventArgs e) this.Close(); private void 学生信息录入ToolStripMenuItem_Click(object sender, EventArgs e) StuIfoEnter ent = new StuIfoEnter(); ent.MdiParent = this; ent.Show(); tssStu.Text = ent.Text; private void 学生信息更新ToolStripMenuItem_Click(object sender, EventArgs e) StuIfoSearch ser = new StuIfoS
6、earch(); ser.MdiParent = this; ser.Show(); tssStu .Text = 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 课程信息录入ToolStripMenuItem_Click(object sender, Event
7、Args e) CourseEnter en = new CourseEnter(); en.MdiParent = this; en.Show(); tssStu.Text = en.Text; private void 成绩录入ToolStripMenuItem_Click(object sender, EventArgs e) ScoreEnter enter = new ScoreEnter(); enter.MdiParent = this; enter.Show () ; tssStu.Text = enter.Text; private void 成绩更新ToolStripMen
8、uItem_Click(object sender, EventArgs e) ScoreUpdate up = 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; ra.Show(); tssStu.Text = ra.Text; private void 班级选课ToolSt
9、ripMenuItem_Click(object sender, EventArgs e) CurChoice ch = new CurChoice(); ch.MdiParent = this; ch.Show(); tssStu.Text = ch.Text; private void 留级休学ToolStripMenuItem_Click(object sender, EventArgs e) Other oth = new Other(); oth.MdiParent = this; oth.Show(); tssStu.Text = oth.Text; private void 留级
10、ToolStripMenuItem_Click(object sender, EventArgs e) Other2 the = new Other2(); the.MdiParent = this; the.Show(); tssStu.Text = the.Text; 学生信息查询代码:namespace StudentIfoMag public partial class StuIfoSearch : Form public StuIfoSearch() InitializeComponent(); private void StuIfoSearch_Load(object sender
11、, EventArgs e) comboBox1.SelectedIndex = 0; / TODO: 这行代码将数据加载到表“studentIfoMagDataSet.Student”中。您可以根据需要移动或移除它。 / this.studentTableAdapter.Fill(this.studentIfoMagDataSet.Student); private void button1_Click(object sender, EventArgs e) string connString = Data Source=.SQLEXPRESS;AttachDb:汪依清2012014574大
12、三C#STUDENTINFORMATIONMAGStudentIfoMag.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True; SqlConnection connection = new SqlConnection(connString); if (textBox1.Text = ) /未输入查询条件时显示全部内容 string sql = String.Format(select * from Student); /SQL语句 try connection.Open(); /打开数据库连接 SqlDataA
13、dapter adapter = new SqlDataAdapter(sql, connection); DataSet DS = new DataSet(); adapter.Fill(DS, Student); dataGridView1.DataSource = DS.TablesStudent; catch (SqlException ex) /数据库出错情况 MessageBox.Show(ex.Message, 操作数据库出错!, MessageBoxButtons.OK, MessageBoxIcon.Error); finally connection.Close(); /关
14、闭数据库情况 else /输入了查询条件 string sql; switch (comboBox1.SelectedItem.ToString() case 学号: sql = String.Format(select * from Student where studentNo = 0 , textBox1.Text); try connection.Open(); /打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); adapter.Fill(D
15、S, Student); dataGridView1.DataSource = DS.TablesStudent; if (DS.Tables0.Rows.Count = 0) /如果未查询到任何信息,给出提示,并显示全部信息 MessageBox.Show(没有查到相关信息,请检查查询条件!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); catch (SqlException ex) /数据库出错情况 MessageBox.Show(ex.Message, 操作数据库出错!, MessageBoxButtons.OK, Mes
16、sageBoxIcon.Error); finally connection.Close(); /关闭数据库连接 break; case 姓名: sql = String.Format(select * from Student where convert(nvarchar(255),studentName) LIKE %0% , textBox1.Text); try connection.Open(); /打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connecti
17、on); adapter.Fill(DS, Student); dataGridView1.DataSource = DS.TablesStudent; if (DS.Tables0.Rows.Count = 0) /如果未查询到任何信息,给出提示,并显示全部信息 MessageBox.Show(没有查到相关信息,请检查查询条件!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); catch (SqlException ex) /数据库出错情况 MessageBox.Show(ex.Message, 操作数据库出错!, Messag
18、eBoxButtons.OK, MessageBoxIcon.Error); finally connection.Close(); /关闭数据库连接 break; case 班级: sql = String.Format(select * from Student where convert(nvarchar(255),studentClass) = 0 , textBox1.Text); try connection.Open(); /打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapte
19、r(sql, connection); adapter.Fill(DS, Student); dataGridView1.DataSource = DS.TablesStudent; if (DS.Tables0.Rows.Count = 0) /如果未查询到任何信息,给出提示,并显示全部信息 MessageBox.Show(没有查到相关信息,请检查查询条件!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); catch (SqlException ex) /数据库出错情况 MessageBox.Show(ex.Message, 操
20、作数据库出错!, MessageBoxButtons.OK, MessageBoxIcon.Error); finally connection.Close(); /关闭数据库连接 break; case 学院: sql = String.Format(select * from Student where convert(nvarchar(255),studentAcademy) LIKE %0% , textBox1.Text); try connection.Open(); /打开数据库连接 DataSet DS = new DataSet(); SqlDataAdapter adapt
21、er = new SqlDataAdapter(sql, connection); adapter.Fill(DS, Student); dataGridView1.DataSource = DS.TablesStudent; if (DS.Tables0.Rows.Count = 0) /如果未查询到任何信息,给出提示,并显示全部信息 MessageBox.Show(没有查到相关信息,请检查查询条件!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); catch (SqlException ex) /数据库出错情况 Message
22、Box.Show(ex.Message, 操作数据库出错!, MessageBoxButtons.OK, MessageBoxIcon.Error); finally connection.Close(); /关闭数据库连接 break; private void button3_Click(object sender, EventArgs e) this.Close(); private void button2_Click(object sender, EventArgs e) string connString = Data Source=.SQLEXPRESS;AttachDb:汪依清
23、2012014574大三C#STUDENTINFORMATIONMAGStudentIfoMag.mdf;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 SqlDataAda
24、pter(sql, connection); DataSet DS = new DataSet(); adapter.Fill(DS, Student); dataGridView1.DataSource = DS.TablesStudent; studentTableAdapter.Fill(studentIfoMagDataSet.Student); 5.总结本次系统设计让我知道了进行管理系统开发这样的工作,要有恒心,要能静下新来做,而不能浮躁。要真真实实的多查资料,多问,多看。要善于同同学和老师交流与合作,善于获取各种有用的资源。更让我认识到一个系统开发的过程中编码不是重要的,最重要的是分析系统、建立起系统模型。只有分析出来才能进行编码。在分析一个系统前,操作者必须要对将要开发的系统所涉及到的各方面知识有一个整体的认识,然后将系统的模型建立起来。在程序编写中,我认识到软件要有简便的界面,良好的程序风格。拥有这些条件,程序的可读性才会好,开发的复杂度才能大大减少,修改代码时更加容易下手。