《学生成绩管理系统.doc》由会员分享,可在线阅读,更多相关《学生成绩管理系统.doc(27页珍藏版)》请在三一文库上搜索。
1、 学生成绩管理系统学生成绩管理系统目录1. 学生成绩管理系统11.1、需求分析11.2、系统设计11.2.1 用例图21.2.2顺序图21.2.3 加载流程31.3、系统结构31.3.2 系统结构41.4、部分模块及界面设计41.4.1主界面41.4.2登录模块51.4.3学生信息查询71.4.4学生成绩查询91.4.5学生信息修改121.4.6学生成绩录入161.5、数据库后台设计191.5.1部分数据表设计19- - 2 - -1. 学生成绩管理系统1.1、需求分析管理员使用系统的流程一般是,首先进入系统,然后选择某个功能。(1) 学生成绩查询 (2) 添加学生 (3) 课程信息录入(4)
2、 学生成绩录入本系统的使用的结构如图1-1所示。图1-1 结构图 1.2、系统设计1.2.1 用例图本系统就一个管理员如图1-2 用例图所示图1-2 用例图1.2.2顺序图在添加板块的过程中,管理员首先输入必要的信息等,最后提交给数据库,由数据库将内容加入数据库中,更具输入信息返回学生信息。图1-3是管理员添加学生顺序图。 图1-3顺序图。1.2.3 加载流程图1-4 加载功能模块的流程1.3、系统结构1.3.1 系统结构 图1-5系统结构图。1.4、部分模块及界面设计1.4.1主界面(1)Main.cs页面是成绩系统的的主页面,主要显示成绩系统里所有的板块。如下图图3-6主界面(2)加载页面
3、代码如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace 学生成绩管理系统3 public partial class Mian : Form OleDbConnection conn=new OleDbConnection(); OleDbDataAdapter
4、 da; DataSet ds; public Mian() InitializeComponent(); conn = new OleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DB.mdb); ds = new DataSet(); private void selectToolStripMenuItem_Click(object sender, EventArgs e) Select addform = new Select(); addform.ShowDialog(); /调用? Select窗体? privat
5、e void 查询成绩ToolStripMenuItem_Click(object sender, EventArgs e) 查询成绩 selectForm = new 查询成绩(); selectForm.ShowDialog(); /调用?查询成绩窗体? private void 删?除y成绩ToolStripMenuItem_Click_1(object sender, EventArgs e) 删?除y成绩 deleteForm = new 删?除y成绩(); deleteForm.ShowDialog(); /调用?删?除y成绩窗体? private void button2_Cli
6、ck(object sender, EventArgs e) 添加成绩 addform = new 添加成绩(); addform.ShowDialog(); /调用?添加成绩窗体? private void 添加课?程记?录?ToolStripMenuItem_Click(object sender, EventArgs e) 添加课?程记?录? addform = new 添加课?程记?录?(); addform.ShowDialog(); /调用?添加课?程记?录?窗体? private void button3_Click(object sender, EventArgs e) 添加新
7、?学生 addStuForm = new 添加新?学生(); addStuForm.ShowDialog(); /调用?添加新?学生窗体? private void 修T改?成绩ToolStripMenuItem_Click_1(object sender, EventArgs e) 修T改? updateForm = new 修T改?(); updateForm.ShowDialog(); /调用?修T改?窗体? private void Form1_Load(object sender, EventArgs e) Login frm = new Login(); if (DialogRes
8、ult.OK = frm.ShowDialog() return; else Application.Exit(); private void 退?出?ToolStripMenuItem_Click_1(object sender, EventArgs e) if (MessageBox.Show(提示?:o + 要a退?出?管理系统3吗e??, 消?息, MessageBoxButtons.YesNo) = DialogResult.Yes) this.Close(); private void getData() da = new OleDbDataAdapter(select 姓?名?,
9、score.学号?,班级?,年级?,专业,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and score.课?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(da); da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; conn.Close(
10、); private void toolStripMenuItem2_Click(object sender, EventArgs e) ds.Clear(); getData(); private void button1_Click(object sender, EventArgs e) ds.Clear(); getData(); private void button5_Click(object sender, EventArgs e) this.Close(); 1.4.2登录模块(1)login.cs页面是系统的登录页面。如下图(2)登录页面代码如下:using System;us
11、ing System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace 学生成绩管理系统3 public partial class Login : Form public Login() InitializeComponent(); private void loginBtn_Click(object sender
12、, EventArgs e) string conStr = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DB.mdb; OleDbConnection conn = new OleDbConnection(conStr); conn.Open(); string cmdStr = select * from Login where ( 用?户名?= LoginName) and( 密码? = Pwd); OleDbCommand cmd = new OleDbCommand(cmdStr, conn); cmd.Parameters.Add(Lo
13、ginName, OleDbType.Integer); cmd.Parameters.Add(pwd, OleDbType.Integer); cmd.ParametersLoginName.Value = Convert.ToInt32( userNameTbx.Text); cmd.Parameterspwd.Value = Convert.ToInt32(pswTbx.Text); OleDbDataReader reader = cmd.ExecuteReader(); if (reader.Read() this.DialogResult = DialogResult.OK; el
14、se MessageBox.Show(用?户名?或密码?错误!); Application.Exit(); reader.Close(); cmd.Connection.Close(); conn.Close(); private void cancleBtn_Click(object sender, EventArgs e) this.Close(); 1.4.4学生成绩查询(1) 查询成绩.cs页面是系统的学生成绩查询页面。如下图(2) 学生成绩查询页面代码如下: using System;using System.Collections.Generic;using System.Comp
15、onentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;namespace 学生成绩管理系统3 public partial class 查询成绩 : Form OleDbConnection conn; OleDbDataAdapter da; DataSet ds; private System.Data.DataTable myTable=new DataTable(); public 查询成绩() Init
16、ializeComponent(); conn = new OleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DB.mdb); ds = new DataSet(); private void getData() da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and score.课
17、?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(da); da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; conn.Close(); private void 查询成绩_Load(object sender, EventArgs e) / TODO: 这a行D代码?将?数y据Y加载?到?表“dBDataSet11.course”中D。您可以?根据Y需要a移?动或移?除y
18、它。 this.courseTableAdapter.Fill(this.dBDataSet11.course); / TODO: 这a行D代码?将?数y据Y加载?到?表“dBDataSet11.student”中D。您可以?根据Y需要a移?动或移?除y它。 this.studentTableAdapter.Fill(this.dBDataSet11.student); getData(); private void fillByToolStripButton_Click(object sender, EventArgs e) try this.studentTableAdapter.Fill
19、By(this.dBDataSet11.student); catch (System.Exception ex) System.Windows.Forms.MessageBox.Show(ex.Message); private void dataGridView1_Click(object sender, EventArgs e) try stu_name_comboBox.Text = dataGridView1.CurrentRow.Cells0.Value.ToString(); stu_id_comboBox.Text = dataGridView1.CurrentRow.Cell
20、s1.Value.ToString(); class_comboBox.Text = dataGridView1.CurrentRow.Cells2.Value.ToString(); grade_comboBox.Text = dataGridView1.CurrentRow.Cells3.Value.ToString(); course_comboBox.Text = dataGridView1.CurrentRow.Cells4.Value.ToString(); /dataGridView1.CurrentRow.Cells0.Selected = true; catch (Excep
21、tion) MessageBox.Show(错误:o + 所查询记?录?不?存?在,?未能选?定值!?!?, 出?现?错误, MessageBoxButtons.OK, MessageBoxIcon.Error); private void ok_btn_Click(object sender, EventArgs e) ds.Clear(); da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where sc
22、ore.学号?=student.学号? and score.学号?= + stu_id_comboBox.Text + and score.课?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(da); try da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; stu_name_comboBox.Text = dataGridView1.CurrentRow.Cells0.V
23、alue.ToString(); catch (Exception) MessageBox.Show(查找出?错:o + 没?有D符?合?该?条?件t的?记?录?,?请?确认?输?入?的?数y据Y是?否?正y确!?, 出?现?错误, MessageBoxButtons.OK, MessageBoxIcon.Error); finally conn.Close(); private void update_btn_Click(object sender, EventArgs e) private void classSelect_btn_Click(object sender, EventArg
24、s e) ds.Clear(); da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and 班级?= + class_comboBox.Text + and score.课?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = new OleDbCommandBu
25、ilder(da); try da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; catch (Exception) MessageBox.Show(查找出?错:o + 没?有D符?合?该?条?件t的?记?录?,?请?确认?输?入?的?数y据Y是?否?正y确!?, 出?现?错误, MessageBoxButtons.OK, MessageBoxIcon.Error); finally conn.Close(); private void nameSelect_btn_Click(object sender, EventA
26、rgs e) ds.Clear(); da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and 姓?名?= + stu_name_comboBox.Text + and score.课?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = new OleDbCom
27、mandBuilder(da); try da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; catch (Exception) MessageBox.Show(查找出?错:o + 没?有D符?合?该?条?件t的?记?录?,?请?确认?输?入?的?数y据Y是?否?正y确!?, 出?现?错误, MessageBoxButtons.OK, MessageBoxIcon.Error); finally conn.Close(); private void gradeSelect_btn_Click(object sender,
28、 EventArgs e) ds.Clear(); da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and 年级?= + grade_comboBox.Text + and score.课?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = new OleDb
29、CommandBuilder(da); try da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; catch (Exception) MessageBox.Show(查找出?错:o + 没?有D符?合?该?条?件t的?记?录?,?请?确认?输?入?的?数y据Y是?否?正y确!?, 出?现?错误, MessageBoxButtons.OK, MessageBoxIcon.Error); finally conn.Close(); private void courseSelect_btn_Click(object sen
30、der, EventArgs e) ds.Clear(); da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and 课?程名?= + course_comboBox.Text + and score.课?程代号?=course.课?程代号? , conn); conn.Open(); OleDbCommandBuilder cmdBuilder = ne
31、w OleDbCommandBuilder(da); try da.Fill(ds, score); dataGridView1.DataSource = ds.Tablesscore; catch (Exception) MessageBox.Show(查找出?错:o + 没?有D符?合?该?条?件t的?记?录?,?请?确认?输?入?的?数y据Y是?否?正y确!?, 出?现?错误, MessageBoxButtons.OK, MessageBoxIcon.Error); finally conn.Close(); private void AllSelect_btn_Click(object sender, EventArgs e) ds.Clear(); da = new OleDbDataAdapter(select 姓?名?,score.学号?,班级?,年级?,课?程名?,成绩,绩点?,开a课?时间?,任?课?教师|,学时,学分? from score,course,student where score.学号?=student.学号? and 班级?= + class_comboBox.Text + and 课?程名?= + course_comboBox.Text + and 姓?名?= + stu_name_comboBox.Text + an