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

上传人:wj 文档编号:2124031 上传时间:2023-05-02 格式:DOCX 页数:28 大小:386.30KB
下载 相关 举报
C与SQL数据库学生成绩管理系统代码.docx_第1页
第1页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第2页
第2页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第3页
第3页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第4页
第4页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第5页
第5页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第6页
第6页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第7页
第7页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第8页
第8页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第9页
第9页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第10页
第10页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第11页
第11页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第12页
第12页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第13页
第13页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第14页
第14页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第15页
第15页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第16页
第16页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第17页
第17页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第18页
第18页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第19页
第19页 / 共28页
C与SQL数据库学生成绩管理系统代码.docx_第20页
第20页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

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

《C与SQL数据库学生成绩管理系统代码.docx》由会员分享,可在线阅读,更多相关《C与SQL数据库学生成绩管理系统代码.docx(28页珍藏版)》请在冰点文库上搜索。

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

数据库技术及应用项目设计报告

学生成绩管理系统

姓名:

CeliaYan

2015-01-07

一.设计目的及意义

在如今的高校日常管理中,学生成绩管理系统是其中非常重要的一环,特别是当前学校规模不断扩大,学生人数日益增加,课程门类多,校区分散等实际情况,学生成绩统计功能越来越繁重,稍有疏忽就会出现差错。

因此,学生成绩管理系统更具有非常大的实际应用意义。

在互联网快速崛起的今天,改革传统的手工录入方式,公正,准确,及时反映学生的信息和成绩的情况,以适应信息时代的要求,是学生成绩管理系统的一个新的理念。

通过成绩管理可以大大提高学校的工作效率。

学生成绩管理系统应该完成以下两个方面的内容:

学生档案资料的管理、学生成绩的管理。

通过学生成绩管理系统可以做到信息的规范管理,科学统计和快速查询、修改、增加、删除等,减少管理方面的工作量。

二.主要功能

该系统主要用于学校学生信息管理,总体任务是实现学生信息关系的系统化、规范化和自动化,其主要任务是用计算机对学生信息进行日常管理,如查询、修改、增加、删除,另外还考虑到用户登录的权限,针对学生信息和权限登录的学生成绩管理系统。

本系统主要包括注册管理、教师管理、学生信息查询、添加、修改、删除等部分。

其主要功能有:

(1)学生信息的添加,包括输入学生基本信息和成绩。

(2)学生信息的查询,包括查询学生的基本信息和成绩。

(3)学生信息的修改,包括修改学生基本信息和成绩。

(4)学生信息的删除,包括删除学生基本信息和成绩。

(5)登录用户密码修改,用户登录到系统可进行相应的用户密码修改。

(6)管理员用户对用户名的管理,包括添加新用户、删除用户。

学生成绩管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序开发两个方面。

对于前者要求建立起数据一致性和完整性强、数据安全性好的数据库。

对于后者则要求应用程序功能完备,易使用。

该管理系统我使用的是MicrosoftVisualStudio2012及MicrosoftSQLServer2008。

系统功能流程图

图2.1系统功能流程

三.数据库设计

3.1本系统的数据库采用的是SQLServer2008。

该数据库包括学生成绩表、用户登录表用于纪录学生的基本信息数据库表结构如下:

成绩表物理结构

图3.1

图3.2

用户登录表物理结构:

图3.3

图3.4

3.2触发器

删除DLB中的记录时同时删除CJB中姓名相同的记录

USE[studentscore]

GO

/******Object:

Trigger[dbo].[dlb_delete]ScriptDate:

01/07/201512:

42:

17******/

SETANSI_NULLSON

GO

SETQUOTED_IDENTIFIERON

GO

ALTERtrigger[dbo].[dlb_delete]

on[dbo].[dlb]afterdelete

as

begin

declare@leibvarchar(50)

select@leib='学生'fromdeleted

deletefromcjb

where姓名in(select用户名fromdeleted)

End

3.3数据库连接

stringconstr="Password=617804;PersistSecurityInfo=True;UserID=ywj;InitialCatalog=studentscore;DataSource=YANJING";

SqlConnectionconn=newSqlConnection(constr);

stringsqlstr="select*fromcjb";

SqlCommandcmd=newSqlCommand(sqlstr,conn);

SqlDataReaderreader=cmd.ExecuteReader();

DataSetds=newDataSet();

while(reader.Read())

{

stringid=reader["学号"].ToString();

stringname=reader["姓名"].ToString();

MessageBox.Show(string.Format("id={0},name={1},学号,姓名"));

}

四.系统实现

4.1.登录界面

图4.1

该界面是学生成绩管理系统的登录界面,可以选择作为学生,管理员或者教师身份登录。

每一个进入系统的人都会看到当前的时间,在登录时只有用户名,密码,与身份相符合时才能进入系统,否则登录无法成功。

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Threading.Tasks;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

namespaceWindowsFormsApplication1

{

publicpartialclassForm1:

Form

{

staticpublicstringsn,sub;

publicForm1()

{

InitializeComponent();

}

Form2fr2=newForm2();Form3fr3=newForm3();Form4fr4=newForm4();

privatevoidForm1_Load(objectsender,EventArgse)

{

timer1.Start();

}

privatevoidlabel1_Click(objectsender,EventArgse)

{

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

stringconstr="Password=617804;PersistSecurityInfo=True;UserID=ywj;InitialCatalog=studentscore;DataSource=YANJING";

SqlConnectionconn=newSqlConnection(constr);

conn.Open();

if(textname.Text==""||textpassword.Text=="")

MessageBox.Show("信息不全,请不要遗漏信息!

");

if(rbtnmanager.Checked)

{

stringcstr="select*fromdlbwhere类别='管理员'and用户名='"+textname.Text.Trim()+"'and密码='"+textpassword.Text.Trim()+"'";

SqlCommandcomm=newSqlCommand(cstr,conn);

SqlDataReaderdr=comm.ExecuteReader();

if(dr.Read())

{

sn=textname.Text.Trim();fr4.Show();this.Visible=false;

;

}

else

{

MessageBox.Show("密码或用户名出错,请重新输入!

");

textname.Text="";textpassword.Text="";

}

}

if(rbtnteacher.Checked)

{

stringcstr="select*fromdlbwhere类别='教师'and用户名='"+textname.Text.Trim()+"'and密码='"+textpassword.Text.Trim()+"'";

SqlCommandcomm=newSqlCommand(cstr,conn);

SqlDataReaderdr=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(rbtnstudent.Checked)

{

stringcstr="select*fromdlbwhere类别='学生'and用户名='"+textname.Text.Trim()+"'and密码='"+textpassword.Text.Trim()+"'";

SqlCommandcomm=newSqlCommand(cstr,conn);

SqlDataReaderdr=comm.ExecuteReader();

if(dr.Read())

{

sn=textname.Text.Trim();fr2.Show();this.Visible=false;

}

else

{

MessageBox.Show("密码或用户名出错,请重新输入!

");

textname.Text="";textpassword.Text="";

}

}

conn.Close();conn.Dispose();

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

Application.Exit();

}

privatevoidtimer1_Tick(objectsender,EventArgse)

{

label4.Text="当前时间:

"+DateTime.Now.ToLongDateString()+""+DateTime.Now.ToLongTimeString();

}

}

}

4.2学生成绩管理

图4.2

设计过程:

 

此部分主要针对学生信息的管理,可以查询学生的所有成绩信息,实现成绩的添加、删除、修改、计算平均分等功能。

还可以修改当前用户下的密码。

privatevoidForm2_Load(objectsender,EventArgse)

{

label1.Text=Form1.sn+"同学,欢迎你进入成绩管理系统!

";

timer1.Start();

groupBox1.Visible=false;

groupBox2.Visible=false;

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

}

privatevoidbutton3_Click(objectsender,EventArgse)

{

//stringconstr="Password=null;PersistSecurityInfo=True;UserID=BINIANDOUKOU\administrator;InitialCatalog=studentscore;DataSource=BINIANDOUKOU\\SQLEXPRESS";

//SqlConnectionconn=newSqlConnection(constr);

//conn.Open();

//SqlDataAdapterda=newSqlDataAdapter("Select*fromcjbwhere姓名="+textBox1.Text,conn);

//DataSetds=newDataSet();

//da.Fill(ds,"usertable");

//dataGridView1.DataSource=;

}

privatevoidtoolStripButton1_Click(objectsender,EventArgse)

{

dataGridView1.Visible=true;groupBox1.Visible=false;groupBox2.Visible=false;

stringconstr="Password=617804;PersistSecurityInfo=True;UserID=ywj;InitialCatalog=studentscore;DataSource=YANJING";

SqlConnectionconn=newSqlConnection(constr);

conn.Open();

SqlDataAdapterda=newSqlDataAdapter("select*fromcjbwhere姓名='"+Form1.sn.Trim()+"'",conn);//----详细信息

DataSetds=newDataSet();

da.Fill(ds,"usertable");

dataGridView1.DataSource=ds.Tables["usertable"].DefaultView;

conn.Close();conn.Dispose();

}

privatevoidtoolStripButton2_Click(objectsender,EventArgse)

{

}

privatevoidtoolStripButton4_Click(objectsender,EventArgse)

{

groupBox1.Visible=true;

}

privatevoidbutton1_Click_1(objectsender,EventArgse)

{

stringconstr="Password=617804;PersistSecurityInfo=True;UserID=ywj;InitialCatalog=studentscore;DataSource=YANJING";

SqlConnectionconn=newSqlConnection(constr);

conn.Open();

if(textnpd.Text!

=textpassword.Text){MessageBox.Show("密码输入有误,请重新输入");}

if(textnpd.Text==""&&textpassword.Text==""){MessageBox.Show("密码不允许为空!

");}

if(textnpd.Text==textpassword.Text&&textnpd.Text!

="")

{

SqlCommandcom=newSqlCommand("updatedlbset密码='"+textpassword.Text.Trim()+"'where用户名='"+Form1.sn.Trim()+"'",conn);

if(com.ExecuteNonQuery()==1)

{

MessageBox.Show("密码更改成功");groupBox1.Visible=false;

}

}

conn.Close();conn.Dispose();

}

privatevoiddataGridView1_CellContentClick(objectsender,DataGridViewCellEventArgse)

{

}

privatevoidtoolStripButton5_Click(objectsender,EventArgse)

{

this.Close();Form1l=newForm1();l.Visible=true;

}

privatevoidtoolStripButton6_Click(objectsender,EventArgse)

{

//stringconstr="Password=null;PersistSecurityInfo=True;UserID=BINIANDOUKOU\administrator;InitialCatalog=studentscore;DataSource=BINIANDOUKOU\\SQLEXPRESS";

//SqlConnectionconn=newSqlConnection(constr);

//conn.Open();

//SqlDataAdapterda=newSqlDataAdapter("Select*fromcjbwhere姓名="+textBox1.Text,conn);

//DataSetds=newDataSet();

//da.Fill(ds,"usertable");

//strings;

//for(inti=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());

//}

}

privatevoidgroupBox2_Enter(objectsender,Even

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2