首页 C#+SQL学生成绩管理系统完整版

C#+SQL学生成绩管理系统完整版

举报
开通vip

C#+SQL学生成绩管理系统完整版学生成绩管理系统 学生成绩管理系统 摘 要 随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。管理信息系统是一个不断发展的新型学科,任何一个单位要生存要发展,要高效率地把内部活动有机地组织起来,就必须建立与自身特点相适应的管理信息系统。 本系统是在管理信息系统的理论和方法指导下、数据库技术支持下完成的。本文在结构上首先论述了程序设计目的和意义,然后叙述了开发环境、开发平台以及数据库技术,接着用图片、说明和代码的方式介绍了系统的整体规划,接下来是系统在具体实现中的详细内容,最终本系统能...

C#+SQL学生成绩管理系统完整版
学生成绩管理系统 学生成绩管理系统 摘 要 随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。管理信息系统是一个不断发展的新型学科,任何一个单位要生存要发展,要高效率地把内部活动有机地组织起来,就必须建立与自身特点相适应的管理信息系统。 本系统是在管理信息系统的理论和方法指导下、数据库技术支持下完成的。本文在结构上首先论述了程序设计目的和意义,然后叙述了开发环境、开发平台以及数据库技术,接着用图片、说明和代码的方式介绍了系统的整体规划,接下来是系统在具体实现中的详细内容,最终本系统能够完成信息的添加、修改、删除、查询等功能,本系统界面友好,操作简单,比较实用,思路缜密严谨,管理起来方便快捷,能有效的达到学生信息的管理的目的。 关键词:Microsoft Visual C#2008 Express Edition,SQL server2005,界面,权限 目 录 TOC \o "1-3" \h \z \u 第一章 绪 论 1 第二章 系统介绍 2 第三章 数据库的设计 3 3.1系统功能流程图 3 3.2 数据库设计 4 3.2.1 各表的物理结构 4 3.2.2数据库连接代码 5 第四章 主要内容 6 4.1登陆界面 6 4.2学生成绩管理界面 9 4.3教师管理界面 13 4.4管理员界面 18 总结 22 参考文献 23 图表清单 图3.1 系统功能流程…………………………………………………………3 图 4.1 登陆界面………………………………………………………………6 图 4.2 学生成绩管理界面………………………………………………………9 图 4.3 教师管理界面…………………………………………………………13 图 4.4 管理员界面…………………………………………………………18 表 3.2.1 学生成绩表……………………………………………………………4 表 3.2.2 用户登录表……………………………………………………………4 第一章 绪 论 人类有几千年的历史,计算机从产生到现在只不过50多年,而网络的迅速发展也不过10年的时间。但是,计算机和网络对社会的影响已经迅速扩大,甚至在改变人们的生活。特别是90年代以来,多媒体和网络技术的飞速发展正在以惊人的速度改变着人们的工作方式、交往方式和生活方式。正像著名的未来学家尼葛洛庞帝(1997)所说的:“数字不再只和计算有关,它决定我们的生存。”科学技术是第一生产力,是最先进的生产力。现在,已经没有人怀疑信息技术的发展将会引起人类社会全面和深刻的变革,使人类社会由工业社会迈向信息社会。目前,在社会各个方面都呈现出了与工业社会显著不同的特点。网上书店,网上医院,网上学校,网上购物,网上银行,政府上网等新事物如雨后春笋般涌现出来,对人们的传统生活方式、工作方式产生极大的冲击。使人们感受到技术发展的脉搏和信息时代前进的步伐。 随着学校的规模不断扩大,学生数量急剧增加,有关学生的各种信息量也成倍增长。面对庞大的信息量需要有学生管理系统来提高学生管理工作的效率。通过这样的系统可以做到信息的规范管理、科学统计和快速查询、修改、增加、删除等,从而减少管理方面的工作量。 第二章 系统介绍 本系统主要用于学校学生信息管理,总体任务是实现学生信息关系的系统化、规范化和自动化,其主要任务是用计算机对学生信息进行日常管理,如查询、修改 、增加、删除,另外还考虑到用户登录的权限,针对学生信息和权限登录的学生成绩管理系统。 本系统主要包括注册管理、教师管理、学生信息查询、添加、修改、删除等部分。其功能主要有: (1)学生信息的添加,包括输入学生基本信息和成绩。 (2)学生信息的查询,包括查询学生基本信息和成绩。 (3)学生信息的修改,包括修改学生基本信息和成绩。 (4)学生信息的删除,包括修改学生基本信息和成绩。 (5)登录用户密码修改,用户登录到系统可进行相应的用户密码修改。 (6)管理员用户对用户名的管理,包括添加新用户、删除用户。 学生成绩管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点。 经过分析,我们使用Microsoft公司的Visual C#2008 Express Edition开发工具,利用其提供的各种面向对象的开发工具,尤其是数据窗口这一能方便而简洁操纵数据库的智能化对象,首先在短时间内建立系统应用原型,然后,对初始原型系统进行需求迭代,不断修正和改进,直到形成用户满意的可行系统。 第三章 数据库的设计 3.1系统功能流程图 图 3.1 系统功能流程 3.2 数据库设计 本系统的数据库是SQL server数据库,在SQL环境下创建数据库学生成绩管理系统.mdf文件。该数据库包括学生成绩表、用户登录表用于纪录学生的基本信息数据库表结构如下所示: 3.2.1 各表的物理结构 表3.2.1 学生成绩表 表3.2.2 用户登录表 3.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 = reader["id"].ToString();//根据列名获得数据 string name = reader["name"].ToString(); string sex = reader["sex"].ToString(); MessageBox.Show(string.Format("id={0},name={1},sex={2}", id, name, sex)); } } 第四章 主要内容 4.1登陆界面 图4.1登录界面 设计过程: 用于输入用户名和密码登录,选择相应的用户类型进入系统,若是用户类型选择错误则不能进入系统。输入用户名和密码后点击确定判断数据库中的用户是否为合法用户。 设计代码: 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-PC\\SQLEXPRESS // string str = "Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PC\\SQLEXPRESS"; string str = "Password=123456789;Persist Security Info=True;User ID=sa;Initial Catalog=学生成绩管理系统;Data Source=FLQ-PC\\SQLEXPRESS"; 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(); } } } 4.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-PC\\SQLEXPRESS"; //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-PC\\SQLEXPRESS"; 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.Tables["usertable"].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-PC\\SQLEXPRESS"; 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-PC\\SQLEXPRESS"; // 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.Tables["usertable"].Rows[0][i].ToString()) < 60) // s=int.Parse(ds.Tables["usertable"].Rows[0][i].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-PC\\SQLEXPRESS"; 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 <= 6; i++) { if (int.Parse(ds.Tables["usertable"].Rows[0][i].ToString()) > max) max = int.Parse(ds.Tables["usertable"].Rows[0][i].ToString ()); if (int.Parse(ds.Tables["usertable"].Rows[0][i].ToString ()) 注释 圣经注释小学小古文100篇及注释小古文100篇及注释简短小古文100篇及注释译文小古文100篇及注释 。所谓模块化就是使程序的功能实现分成多个单独的功能模块,而不能在一大段代码中实现多个功能,如果这样做,别的人是非常难读懂你的程序。必要的注释,显而易见是要在程序的编写中加入对程序的说明,原因就是为了别人能读懂你的程序,过一段时间后你自己还能读懂自己的程序。 最后说明下这次毕业设计给我感受最深的有三点: 1.进行管理系统开发这样的工作,要有恒心,要能静下新来做,而不能浮躁。 2.要善于同别人交流与合作,善于获取各种有用的资源。 3.要真真实实的多查资料,多问,多看。 参考文献 [1] 《高效掌握ADO.NET—C#编程篇》Kouresh Ardestani 著,张哲峰 译清华大学出版社 [2] 《ASP.NET企业级开发案例精解(C#)》 中国林业出版社 [3] 《SQL Server数据库开发入门与范例解析》 夏邦贵著 北京机械工 [4] 《Visual C#2005技术内幕》 (美
本文档为【C#+SQL学生成绩管理系统完整版】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_663744
暂无简介~
格式:doc
大小:447KB
软件:Word
页数:26
分类:
上传时间:2013-12-06
浏览量:450