




已阅读5页,还剩19页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
学生成绩管理系统姓名:冼振强 学号:201130690224摘 要随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。管理信息系统是一个不断发展的新型学科,任何一个单位要生存要发展,要高效率地把内部活动有机地组织起来,就必须建立与自身特点相适应的管理信息系统。本系统是在管理信息系统的理论和方法指导下、数据库技术支持下完成的。本文在结构上首先论述了程序设计目的和意义,然后叙述了开发环境、开发平台以及数据库技术,接着用图片、说明和代码的方式介绍了系统的整体规划,接下来是系统在具体实现中的详细内容,最终本系统能够完成信息的添加、修改、删除、查询等功能,本系统界面友好,操作简单,比较实用,思路缜密严谨,管理起来方便快捷,能有效的达到学生信息的管理的目的。22 数据库的设计1.1系统功能流程图老师学生老师学生修改密码详细信息各科成绩学生成绩管理系统用户登录学生成绩管理系统登录管理员系统教师管理系统学生成绩管理系统退出添加删除退出所有成绩查找修改升序排序修改密码退出图 3.1 系统功能流程1.2 数据库设计本系统的数据库是SQL server数据库,在SQL环境下创建数据库学生成绩管理系统.mdf文件。该数据库包括学生成绩表、用户登录表用于纪录学生的基本信息数据库表结构如下所示:1.2.1 各表的物理结构表3.2.1 学生成绩表表3.2.2 用户登录表1.2.2数据库连接代码private void button1_Click(object sender, EventArgs e) string connStr = Server=.;DataBase=LOCAL;Integrated Security=True; /数据库连接字符串,.表示本机服务器DataBase为表名,Integrated Security=True是采用windows身份验证方式登录 SqlConnection conn = new SqlConnection(connStr); /根据连接字符串,新建数据库连接 string sqlStr = select * from student1; /查询student1表的查询语句 SqlCommand cmd = new SqlCommand(sqlStr, conn); /根据查询语句和数据库连接,等到查询命令对象 SqlDataReader reader = cmd.ExecuteReader();/从查询命令对象中获得一个读取数据库数据的对象 while (reader.Read() /循环读取下一行数据,如果下一行没有数据返回false string id = readerid.ToString();/根据列名获得数据 string name = readername.ToString(); string sex = readersex.ToString(); MessageBox.Show(string.Format(id=0,name=1,sex=2, id, name, sex); 主要内容设计过程:用于输入用户名和密码登录,选择相应的用户类型进入系统,若是用户类型选择错误则不能进入系统。输入用户名和密码后点击确定判断数据库中的用户是否为合法用户。设计代码: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.SqlClient;namespace 学生成绩管理系统 public partial class Login : Form static public string sn,sub; public Login() InitializeComponent(); Form2 fr2 = new Form2(); Form3 fr3 = new Form3(); Form4 fr4 = new Form4();/创建新窗体 private void Login_Load(object sender, EventArgs e) timer1.Start(); / Timer控件 private void btnlogin_Click(object sender, EventArgs e) /Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS / string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str);/连接数据库 conn.Open(); if( txtname .Text=|txtpassword .Text=) MessageBox.Show (请不要遗漏信息!); if (rbtnmanager.Checked) string cstr=select * from 用户登录 where 类别=管理员and 用户名=+txtname.Text.Trim ()+and 密码=+txtpassword .Text.Trim ()+; SqlCommand comm=new SqlCommand (cstr,conn ); SqlDataReader dr=comm.ExecuteReader (); if (dr.Read() sn = txtname.Text.Trim(); fr4.Show(); this.Visible = false; else MessageBox.Show(输入有误,请重新输入!); txtname.Text = ; txtpassword.Text = ; if (rbtnteacher.Checked) string cstr = select * from 用户登录 where 类别=教师and 用户名= + txtname.Text.Trim() + and 密码= + txtpassword.Text.Trim() + ; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read() sn = txtname.Text.Trim(); sub = dr.GetValue(3).ToString (); fr3.Show(); this.Visible = false; else MessageBox.Show(输入有误,请重新输入!); txtname.Text = ; txtpassword.Text = ; if (rbtnstudent.Checked) string cstr = select * from 用户登录 where 类别=学生and 用户名= + txtname.Text.Trim() + and 密码= + txtpassword.Text.Trim() + ; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read() sn = txtname.Text.Trim();fr2.Show(); this.Visible=false ; else MessageBox.Show(输入有误,请重新输入!); txtname.Text = ; txtpassword.Text = ; conn.Close(); conn.Dispose(); private void button2_Click(object sender, EventArgs e) Application.Exit(); private void timer1_Tick(object sender, EventArgs e) label1.Text = 当前时间为: +DateTime.Now .ToLongDateString() + +DateTime.Now.ToLongTimeString(); 2学生成绩管理界面图4.2学生成绩管理界面设计过程:此部分主要针对学生信息的管理,可以查询学生的所有成绩信息,实现成绩的添加、删除、修改、计算平均分等功能。还可以修改当前用户下的密码。设计代码: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.SqlClient;namespace 学生成绩管理系统 public partial class Form2 : Form public Form2() InitializeComponent(); private void Form2_Load(object sender, EventArgs e) label1.Text = Login.sn + 同学,欢迎您使用本成绩管理系统!;/用窗体掉用静态变量 timer1.Start(); groupBox1.Visible = false; groupBox2.Visible = false; private void button1_Click(object sender, EventArgs e) private void button3_Click(object sender, EventArgs e) /string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; /SqlConnection conn = new SqlConnection(str); /conn.Open(); /SqlDataAdapter da = new SqlDataAdapter(Select * from 学生成绩表 where 姓名=+textBox1 .Text , conn); /DataSet ds = new DataSet(); /da.Fill(ds, usertable); /dataGridView1.DataSource = ; private void toolStripButton1_Click(object sender, EventArgs e) string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(Select * from 学生成绩表 where 姓名= + Login.sn.Trim ()+,conn);/详细信息 DataSet ds = new DataSet(); da.Fill(ds, usertable); dataGridView1.DataSource = ds.Tablesusertable.DefaultView; conn.Close(); conn.Dispose(); private void toolStripButton2_Click(object sender, EventArgs e) private void toolStripButton4_Click(object sender, EventArgs e) groupBox1.Visible = true; private void button1_Click_1(object sender, EventArgs e) string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); if (txtnpd.Text != txtnpassword.Text) MessageBox.Show(请确认信密码的正确性!); if (txtnpd.Text =& txtnpassword.Text = ) MessageBox.Show(密码不允许为空!); if (txtnpd.Text = txtnpassword.Text & txtnpd.Text!= ) SqlCommand com = new SqlCommand(update 用户登录 set 密码= + txtnpassword.Text.Trim() + where 用户名= + Login.sn.Trim() + , conn); if (com.ExecuteNonQuery() = 1) MessageBox.Show(密码修改成功!); groupBox1.Visible = false; conn.Close(); conn.Dispose(); private void toolStripButton5_Click(object sender, EventArgs e) this.Close(); Login l = new Login(); l.Visible = true;/?、 private void toolStripButton6_Click(object sender, EventArgs e) / string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; / SqlConnection conn = new SqlConnection(str); / conn.Open(); / SqlDataAdapter da = new SqlDataAdapter(Select * from 学生成绩表 where 姓名= + Login.sn.Trim() + , conn); /DataSet ds = new DataSet(); / da.Fill(ds, usertable); / string s; / for (int i = 2; i = 6; i+) / / if (int.Parse(ds.Tablesusertable.Rows0i.ToString() 60) / s=int.Parse(ds.Tablesusertable.Rows0i.ToString(); / private void groupBox2_Enter(object sender, EventArgs e) private void toolStripButton3_Click(object sender, EventArgs e) groupBox2.Visible = true ; string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(Select * from 学生成绩表 where 姓名= + Login.sn.Trim() + , conn); DataSet ds = new DataSet(); da.Fill(ds, usertable); int max=0,min=1001; double ave=0.0; for (int i = 2; i max) max = int.Parse(ds.Tablesusertable.Rows0i.ToString (); if (int.Parse(ds.Tablesusertable.Rows0i.ToString ()min) min =int.Parse(ds.Tablesusertable.Rows0i.ToString(); txthscore.Text = max.ToString (); txtlscore.Text = min.ToString (); txtall.Text =ds.Tablesusertable.Rows0总分.ToString (); ave = int.Parse(ds.Tablesusertable.Rows0总分.ToString()/(double)5; txtave.Text = ave.ToString(); conn.Close(); conn.Dispose(); private void timer1_Tick(object sender, EventArgs e) label6.Text = 当前时间为: + DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString(); 3教师管理界面图4.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.SqlClient;namespace 学生成绩管理系统 public partial class Form3 : Form public Form3() InitializeComponent(); private void Form3_Load(object sender, EventArgs e) lblshow.Text = Login.sn + 老师,欢迎使用本成绩管理系统!; textBox2.Text = Login.sub; groupBox3.Visible = false;/修改密码的框 timer1.Start(); /string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; /SqlConnection conn = new SqlConnection(str); /conn.Open(); /SqlDataAdapter da = new SqlDataAdapter(Select * from 学生成绩表 , conn); /DataSet ds = new DataSet(); /da.Fill(ds, chaxun); /dataGridView1.DataSource = ds.Tableschaxun.DefaultView; private void button1_Click_1(object sender, EventArgs e)/查找框 string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); if (comboBox1.Text = 学号) SqlCommand cm = new SqlCommand(Select 学号,姓名, + Login.sub + from 学生成绩表 where 学号= + textBox1.Text + , conn); if (cm.ExecuteScalar() = null) MessageBox.Show(查无此人!); else SqlDataAdapter da = new SqlDataAdapter(Select 学号,姓名, + Login.sub + from 学生成绩表 where 学号= + textBox1.Text + , conn); DataSet ds = new DataSet(); da.Fill(ds, chaxun); dataGridView1.DataSource = ds.Tableschaxun.DefaultView; if (comboBox1.Text = 姓名) SqlCommand cm = new SqlCommand(Select 学号,姓名, + Login.sub + from 学生成绩表 where 姓名= + textBox1.Text + , conn); if (cm.ExecuteScalar() = null) MessageBox.Show(查无此人!); else SqlDataAdapter da = new SqlDataAdapter(Select 学号,姓名, + Login.sub + from 学生成绩表 where 姓名= + textBox1.Text + , conn); DataSet ds = new DataSet(); da.Fill(ds, table); dataGridView1.DataSource = ds.Tablestable.DefaultView; conn.Close(); conn.Dispose(); private void textBox1_TextChanged(object sender, EventArgs e) private void 查找_Click(object sender, EventArgs e) groupBox1.Enabled = true;/查找框 private void 所有成绩_Click(object sender, EventArgs e)/菜单栏中的按钮 string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(select 学号,姓名, + Login.sub + from 学生成绩表, conn); DataSet ds = new DataSet(); da.Fill(ds, table); dataGridView1.DataSource = ds.Tablestable.DefaultView; conn.Close(); conn.Dispose(); private void button2_Click(object sender, EventArgs e)/修改 string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlCommand com = new SqlCommand(update 学生成绩表 set + Login.sub + = + textBox3.Text + where 姓名= + textBox4.Text + , conn); if (com.ExecuteNonQuery() = 1) MessageBox.Show(修改成功!); conn.Close(); conn.Dispose(); private void 修改_Click(object sender, EventArgs e) groupBox2.Enabled = true; private void groupBox2_Enter(object sender, EventArgs e) private void button3_Click(object sender, EventArgs e)/修改密码 string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); if (txtnpd.Text != txtnpassword.Text) MessageBox.Show(请确认信密码的正确性!); if (txtnpd.Text = & txtnpassword.Text = ) MessageBox.Show(密码不允许为空!); if (txtnpd.Text = txtnpassword.Text & txtnpd.Text != ) SqlCommand com = new SqlCommand(update 用户登录 set 密码= + txtnpassword.Text.Trim() + where 用户名= + Login.sn.Trim() + , conn); if (com.ExecuteNonQuery() = 1) MessageBox.Show(密码修改成功!); groupBox3.Visible = false; conn.Close(); conn.Dispose(); private void 修改密码_Click(object sender, EventArgs e) groupBox3.Visible = true; private void 成绩统计_Click(object sender, EventArgs e) string str = Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PCSQLEXPRESS; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(select 学号,姓名, + Login.sub + from 学生成绩表 order by + Login.sub + desc, conn); DataSet ds = new DataSet(); da.Fill(ds, table); dataGridView1.DataSource = ds.Tablestable.DefaultView; conn.Close(); conn.Dispose(); private void 退出_Click(object sender, EventArgs e) this.Close(); Login l = new Login(); l.Visible = true; private void timer1_Tick(object sender, EventArgs e) label8.Text = 当前时间为:n + DateTime.Now
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 广州小学期末数学试卷
- 广东珠海中考数学试卷
- 寒假刷了20张数学试卷
- 2025移动硬盘买卖合同范本
- 价值观传播机制-洞察及研究
- 广西一模理科数学试卷
- 多源能量协同补偿-洞察及研究
- 医学VR标准化-洞察及研究
- 湖南财经数学试卷
- 微塑料生态风险-第4篇-洞察及研究
- 如何进行高质量的护理查房
- 特征值估计技术-洞察分析
- Unit3 Weather B let's learn(说课稿)-2023-2024学年人教PEP版英语四年级下册
- 2024年新济南版七年级上册生物全册知识点
- 桶装饮用水生产项目可行性研究报告
- 肥胖相关性肾病临床病理及治疗新进展-课件
- 装修工程投标用技术标范文
- 港科金融硕士面试
- 《电力安全工作规程DLT408-2023》知识培训
- 建筑工程危险源台账
- 高级考评员职业技能鉴定考试题库(含答案)
评论
0/150
提交评论