ImageVerifierCode 换一换
格式:DOCX , 页数:23 ,大小:366.21KB ,
资源ID:5502846      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5502846.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C#与SQL数据库学生成绩管理系统完整代码.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C#与SQL数据库学生成绩管理系统完整代码.docx

1、C#与SQL数据库学生成绩管理系统完整代码 数据库技术及应用项目设计报告学生成绩管理系统 姓名:Celia Yan 2015-01-07一设计目的及意义在如今的高校日常管理中,学生成绩管理系统是其中非常重要的一环,特别是当前学校规模不断扩大,学生人数日益增加,课程门类多,校区分散等实际情况,学生成绩统计功能越来越繁重,稍有疏忽就会出现差错。因此,学生成绩管理系统更具有非常大的实际应用意义。在互联网快速崛起的今天,改革传统的手工录入方式,公正,准确,及时反映学生的信息和成绩的情况,以适应信息时代的要求,是学生成绩管理系统的一个新的理念。通过成绩管理可以大大提高学校的工作效率。学生成绩管理系统应该

2、完成以下两个方面的内容:学生档案资料的管理、学生成绩的管理。通过学生成绩管理系统可以做到信息的规范管理,科学统计和快速查询、修改、增加、删除等,减少管理方面的工作量。二主要功能该系统主要用于学校学生信息管理,总体任务是实现学生信息关系的系统化、规范化和自动化,其主要任务是用计算机对学生信息进行日常管理,如查询、修改、增加、删除,另外还考虑到用户登录的权限,针对学生信息和权限登录的学生成绩管理系统。本系统主要包括注册管理、教师管理、学生信息查询、添加、修改、删除等部分。其主要功能有:(1)学生信息的添加,包括输入学生基本信息和成绩。(2)学生信息的查询,包括查询学生的基本信息和成绩。(3)学生信

3、息的修改,包括修改学生基本信息和成绩。(4)学生信息的删除,包括删除学生基本信息和成绩。(5)登录用户密码修改,用户登录到系统可进行相应的用户密码修改。(6)管理员用户对用户名的管理,包括添加新用户、删除用户。 学生成绩管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的数据库。对于后者则要求应用程序功能完备,易使用。该管理系统我使用的是Microsoft Visual Studio 2012 及 Microsoft SQL Server 2008。系统功能流程图图 2.1 系统功能流程三数据库设

4、计3.1本系统的数据库采用的是SQL Server2008 。该数据库包括学生成绩表、用户登录表用于纪录学生的基本信息数据库表结构如下:成绩表物理结构图3.1图3.2用户登录表物理结构:图3.3图3.43.2触发器删除DLB中的记录时同时删除CJB中姓名相同的记录USE studentscoreGO/* Object: Trigger dbo.dlb_delete Script Date: 01/07/2015 12:42:17 */SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER trigger dbo.dlb_deleteon dbo.d

5、lb after deleteasbegindeclare leib varchar(50) select leib=学生from deleteddelete from cjb where 姓名 in (select 用户名 from deleted)End3.3数据库连接 string constr = Password=617804;Persist Security Info=True;User ID=ywj;Initial Catalog=studentscore;Data Source=YANJING; SqlConnection conn = new SqlConnection(co

6、nstr); string sqlstr = select * from cjb; SqlCommand cmd = new SqlCommand(sqlstr, conn); SqlDataReader reader = cmd.ExecuteReader(); DataSet ds = new DataSet(); while (reader.Read() string id = reader学号.ToString(); string name = reader姓名.ToString(); MessageBox.Show(string.Format(id=0,name=1,学号,姓名);

7、四系统实现 4.1.登录界面图4.1该界面是学生成绩管理系统的登录界面,可以选择作为学生,管理员或者教师身份登录。每一个进入系统的人都会看到当前的时间,在登录时只有用户名,密码,与身份相符合时才能进入系统,否则登录无法成功。using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using Syst

8、em.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication1 public partial class Form1 : Form static public string sn, sub; public Form1() InitializeComponent(); Form2 fr2 = new Form2(); Form3 fr3 = new Form3(); Form4 fr4 = new Form4(); private void Form1_Load(object sender, Even

9、tArgs e) timer1.Start(); private void label1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) string constr = Password=617804;Persist Security Info=True;User ID=ywj;Initial Catalog=studentscore;Data Source=YANJING; SqlConnection conn = new SqlConnection(constr

10、); conn.Open(); if (textname.Text = | textpassword.Text = ) MessageBox.Show(信息不全,请不要遗漏信息!); if (rbtnmanager.Checked) string cstr = select * from dlb where 类别=管理员 and 用户名= + textname.Text.Trim() + and 密码= + textpassword.Text.Trim() + ; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr =

11、comm.ExecuteReader(); if (dr.Read() sn = textname.Text.Trim(); fr4.Show(); this.Visible = false; ; else MessageBox.Show(密码或用户名出错,请重新输入!); textname.Text = ; textpassword.Text = ; if (rbtnteacher.Checked) string cstr = select * from dlb where 类别=教师 and 用户名= + textname.Text.Trim() + and 密码= + textpassw

12、ord.Text.Trim() + ; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read() sn = textname.Text.Trim(); sub = dr.GetValue(3).ToString(); fr3.Show(); this.Visible = false; else MessageBox.Show(密码或用户名出错,请重新输入!); textname.Text = ; textpassword.Text = ; if (rb

13、tnstudent.Checked) string cstr = select * from dlb where 类别=学生 and 用户名= + textname.Text.Trim() + and 密码= + textpassword.Text.Trim() + ; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read() sn = textname.Text.Trim(); fr2.Show(); this.Visible = false; el

14、se MessageBox.Show(密码或用户名出错,请重新输入!); textname.Text = ; textpassword.Text = ; conn.Close(); conn.Dispose(); private void button2_Click(object sender, EventArgs e) Application.Exit(); private void timer1_Tick(object sender, EventArgs e) label4.Text = 当前时间: + DateTime.Now.ToLongDateString() + + DateTim

15、e.Now.ToLongTimeString(); 4.2学生成绩管理图4.2设计过程:此部分主要针对学生信息的管理,可以查询学生的所有成绩信息,实现成绩的添加、删除、修改、计算平均分等功能。还可以修改当前用户下的密码。 private void Form2_Load(object sender, EventArgs e) label1.Text = Form1.sn + 同学,欢迎你进入成绩管理系统!; timer1.Start(); groupBox1.Visible = false; groupBox2.Visible = false; private void button1_Clic

16、k(object sender, EventArgs e) private void button3_Click(object sender, EventArgs e) / string constr = Password=null;Persist Security Info=True;User ID=BINIANDOUKOUadministrator;Initial Catalog=studentscore;Data Source=BINIANDOUKOUSQLEXPRESS; /SqlConnection conn = new SqlConnection(constr); /conn.Op

17、en(); /SqlDataAdapter da = new SqlDataAdapter(Select * from cjb where 姓名=+textBox1 .Text , conn); /DataSet ds = new DataSet(); /da.Fill(ds, usertable); /dataGridView1.DataSource = ; private void toolStripButton1_Click(object sender, EventArgs e) dataGridView1.Visible = true; groupBox1.Visible = fals

18、e; groupBox2.Visible = false; string constr = Password=617804;Persist Security Info=True;User ID=ywj;Initial Catalog=studentscore;Data Source=YANJING; SqlConnection conn = new SqlConnection(constr); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(select * from cjb where 姓名= + Form1.sn.Trim() + ,

19、 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

20、 = true; private void button1_Click_1(object sender, EventArgs e) string constr = Password=617804;Persist Security Info=True;User ID=ywj;Initial Catalog=studentscore;Data Source=YANJING; SqlConnection conn = new SqlConnection(constr); conn.Open(); if (textnpd.Text != textpassword.Text) MessageBox.Sh

21、ow(密码输入有误,请重新输入); if (textnpd.Text = & textpassword.Text = ) MessageBox.Show(密码不允许为空!); if (textnpd.Text=textpassword.Text & textnpd.Text !=) SqlCommand com = new SqlCommand(update dlb set 密码= + textpassword.Text.Trim() + where 用户名= + Form1.sn.Trim() + , conn); if (com.ExecuteNonQuery() = 1) Message

22、Box.Show(密码更改成功); groupBox1.Visible = false; conn.Close(); conn.Dispose(); private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) private void toolStripButton5_Click(object sender, EventArgs e) this.Close(); Form1 l = new Form1(); l.Visible = true; private void toolS

23、tripButton6_Click(object sender, EventArgs e) / string constr = Password=null;Persist Security Info=True;User ID=BINIANDOUKOUadministrator;Initial Catalog=studentscore;Data Source=BINIANDOUKOUSQLEXPRESS; /SqlConnection conn = new SqlConnection(constr); /conn.Open(); /SqlDataAdapter da = new SqlDataA

24、dapter(Select * from cjb where 姓名=+textBox1 .Text , 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 sende

25、r, EventArgs e) dataGridView1.Visible = false; groupBox1.Visible = false; private void toolStripButton3_Click(object sender, EventArgs e) groupBox2 .Visible=true; string constr = Password=617804;Persist Security Info=True;User ID=ywj;Initial Catalog=studentscore;Data Source=YANJING; SqlConnection co

26、nn = new SqlConnection(constr); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(Select * from cjb where 姓名=+Form1 .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()

27、; 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=av

28、e.ToString(); conn.Close();conn.Dispose(); private void timer1_Tick(object sender, EventArgs e) label2.Text=当前时间:+DateTime.Now.ToLongDateString()+DateTime.Now.ToLongTimeString(); 4.3教师管理界面 图4.3设计过程:此部分主要针对教师信息管理,可以查询学生的所有成绩信息,实现成绩的添加、删除、修改、成绩升序排序等功能。还可以修改当前用户下的密码。private void button1_Click(object se

29、nder, EventArgs e) /查找 string constr = Password=617804;Persist Security Info=True;User ID=ywj;Initial Catalog=studentscore;Data Source=YANJING; SqlConnection conn= new SqlConnection(constr); conn.Open(); if (comboBox1.Text=学号) SqlCommand cm=new SqlCommand(select 学号,+Form1 .sub + from cjb where 学号=+ textBox1.Text+,conn ); if (cm.ExecuteScalar ()=null)MessageBox.Show(用户名不存在); else SqlDataAdapter da =new SqlDataAdapter(select 学号,+Form1.sub+

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1