C#大作业学生成绩管理系统

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

C#大作业学生成绩管理系统
————————————————————————————————作者:————————————————————————————————日期:
《c#程序设计》大作业
题目:学生成绩管理系统
班级:
学号:
姓名:
小组成员分工:
姓名分工
汪依清:StuIfoupdate
Login
傅勤珍:Other
Rank
斯王春:StuIfoSearch
Mainframe
黄成烽:StuIfoChange
CourseEnter
吴凯: StuoIfoEnter
ScoreEnter
朱隆震:CurChoice
ScoreUpdate
洪彬:Other2
学生成绩管理系统
------主界面的设计和学生信息查询
主界面的设计:
主界面设计要求简单明了,能把系统的所有功能展现在主界面上面,能让人方便的查询学生的各种信息,包括系统管理、学生信息管理、课程信息管理、成绩信息管理、选课信息管理、特殊情况管理等功能,不仅如此,界面的设计也要美观大方,这样很好的实现了人机交互。

学生信息查询:
1.1功能
(1)根据查询条件实现学生信息的查询
(2)学生选课信息查询、成绩信息的查询
(3) 学生信息、课程信息、成绩信息的增加、删除、修改
(4) 对基本信息完成增加、删除、修改时,需注意表与表之间的关联
1.2功能需求分析
学生信息查询:学生可以根据学号、姓名、专业进行查询.
1.3软件环境需求
利用Visual Studio 2010作为前台开发工具,后台SQL 数据库管理实现学生成绩管理系统。

设计
2.1学生信息查询模块
学生信息查询:学生可以根据学号、姓名、班级、学院进行查询。

2.2学生信息内容
学生的信息包括学号,姓名,性别,民族,班级,院系,出生日期,政治面貌。

班级
学院查
学生信息查学号
姓名
学 生

息 学
号 姓名 性别 民族 班级 院系 出生政治
3.数据库设计
本系统的数据库是SQL server数据库,在SQL环境下创建数据库学生管理系统文件。

根据以上模块划分图分析,针对学生信息管理系统,分别对个人基本信息、选课、成绩进行详细的研究分析。

数据库的设计采用一库多表式设计。

即设计了一个用户登录,添加学生信息,数据库中对学生的信息加入基础的添加、查询、修改和删除。

该数据库包括Student、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 sender, 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 StuIfoSearch();
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, EventArgs 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成绩更新ToolStripMenuItem_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班级选课ToolStripMenuItem_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留级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, 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\大三\C#\STUDENTINFORMATIONMAG\StudentIfoMag.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(); //打开数据库连接
SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
DataSet DS = new DataSet();
adapter.Fill(DS, "Student");
dataGridView1.DataSource = DS.Tables["Student"];
}
catch (SqlException ex) //数据库出错情况
{
MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
connection.Close(); //关闭数据库情况
}
}
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(DS, "Student");
dataGridView1.DataSource = DS.Tables["Student"];
if (DS.Tables[0].Rows.Count == 0) //如果未查询到任何信息,给出提示,并显示全部信息
{
MessageBox.Show("没有查到相关信息,请检查查询条件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (SqlException ex) //数据库出错情况
{
MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.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, connection); adapter.Fill(DS, "Student");
dataGridView1.DataSource = DS.Tables["Student"];
if (DS.Tables[0].Rows.Count == 0) //如果未查询到任何信息,给出提示,并显示全部信息
{
MessageBox.Show("没有查到相关信息,请检查查询条件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (SqlException ex) //数据库出错情况
{
MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.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 SqlDataAdapter(sql, connection); adapter.Fill(DS, "Student");
dataGridView1.DataSource = DS.Tables["Student"];
if (DS.Tables[0].Rows.Count == 0) //如果未查询到任何信息,给出提示,并显示全部信息
{
MessageBox.Show("没有查到相关信息,请检查查询条件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (SqlException ex) //数据库出错情况
{
MessageBox.Show(ex.Message, "操作数据库出错!", 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 adapter = new SqlDataAdapter(sql, connection); adapter.Fill(DS, "Student");
dataGridView1.DataSource = DS.Tables["Student"];
if (DS.Tables[0].Rows.Count == 0) //如果未查询到任何信息,给出提示,并显示全部信息
{
MessageBox.Show("没有查到相关信息,请检查查询条件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (SqlException ex) //数据库出错情况
{
MessageBox.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:\汪依清2012014574\
大三\C#\STUDENTINFORMATIONMAG\StudentIfoMag.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 SqlDataAdapter(sql, connection);
DataSet DS = new DataSet();
adapter.Fill(DS, "Student");
dataGridView1.DataSource = DS.Tables["Student"];
studentTableAdapter.Fill(studentIfoMagDataSet.Student);
}
}
}
5.总结
本次系统设计让我知道了进行管理系统开发这样的工作,要有恒心,要能静下新来做,而不能浮躁。

要真真实实的多查资料,多问,多看。

要善于同同学和老师交流与合作,善于获取各种有用的资源。

更让我认识到一个系统开发的过程中编码不是重要的,最重要的是分析系统、建立起系统模型。

只有分析出来才能进行编码。

在分析一个系统前,操作者必须要对将要开发的系统所涉及到的各方面知识有一个整体的认识,然后将系统的模型建立起来。

在程序编写中,我认识到软件要有简便的界面,良好的程序风格。

拥有这些条件,程序
的可读性才会好,开发的复杂度才能大大减少,修改代码时更加容易下手。

相关文档
最新文档