C#学生信息管理系统

发布时间:2015-05-17 21:20:12   来源:文档文库   
字号:

课程设计(论文)

蚌埠学院教务处制

中文摘要 2

英文摘要 3

1学生数据库需求分析 4

1.1用户需求 4

1.2功能流程分析 4

2概念设计 6

3逻辑设计 7

3.1数据库初步构思框架 7

3.2 具体逻辑模型设计 7

4物理设计 8

5 功能模块设计 8

5.1主模块设计 8

5.2相关子模块的设计 9

5.2.1登陆模块 9

5.2.2主界面模块 10

5.2.3学生信息管理模块 13

5.2.4班级信息管理模块 18

5.2.5成绩信息管理模块 19

6 功能运行截图 21

6.1登录系统界面 21

6.2学生信息管理系统界面 21

6.3学生信息管理界面 22

6.3.1添加学生信息界面 22

6.3.2删除学生信息界面 23

6.3.3查找学生信息界面 23

6.3.4修改学生信息界面 24

6.4班级信息管理界面 25

6.4.1查找班级信息界面 25

6.4.2删除班级信息界面 26

6.4.3修改班级信息界面 27

6.5成绩信息管理界面 28

6.5.1添加学生成绩 28

6.5.2查询学生成绩界面 28

6.5.3修改学生成绩界面 29

7 课程设计总结 29

8 结束语 30

30

附录:程序清单 31

中文摘要

C sharp(又被简称为"C#")微软公司在二OOO年六月发布的一种新的编程语言,并定于在微软职业开发者论坛(PDC)上登台亮相。C#是微软公司研究员Anders Hejlsberg的最新成果。C#看起来与Java有着惊人的相似;它包括了诸如单一继承、界面、与Java几乎同样的语法,和编译成中间代码再运行的过程。但是C#Java有着明显的不同,它借鉴了Delphi的一个特点,与COM(组件对象模型)是直接集成的,而且它是微软公司.NET windows网络框架的主角。

数据库管理系统(database management system)是一种操纵和管理数据库的大型软件,用于建立、使用和维护数据库,简称dbms。它对数据库进行统一的管理和控制,以保证数据库的安全性和完整性。用户通过dbms访问数据库中的数据,数据库管理员也通过dbms进行数据库的维护工作。它可使多个应用程序和用户用不同的方法在同时或不同时刻去建立,修改和询问数据库。DBMS提供数据定义语言DDLData Definition Language)与数据操作语言DMLData Manipulation Language),供用户定义数据库的模式结构与权限约束,实现对数据的追加、删除等操作。

英文摘要

C sharp (also referred to simply as "C#") is Microsoft in June 2 ooo year released a new programming language, and is scheduled to professional developers in Microsoft BBS (PDC) on Wednesday. C # is Microsoft Anders Hejlsberg researcher at the latest results. C# looks and Java have an amazing is similar; It includes such as a single inheritance, interface, and Java almost as the grammar, and compiled into the middle of the code and run process. But C# and Java is quite different, it lessons from the Delphi a characteristic, and COM (component object model) is a direct integration, and it is Microsoft.net Windows network framework protagonist.

Database management system (database management system) is a kind of control and management of large database software, used to establish, maintain and use the database, hereinafter referred to as the DBMS. It the database management and control of unity, in order to ensure the security and integrity of the database. The user through DBMS access database data, database administrators also through the DBMS database maintenance work. It can make the multiple applications and users with different methods simultaneously or in different time to build up, modify, and ask the database. DBMS provides the Data Definition Language DDL (Data Definition Language) and Data operation Language DML (Data Manipulation Language), for the user to define the database model structure and authority restriction, make the Data super addition, delete operation.

1学生数据库需求分析

1.1用户需求

问题的提出

为了更好的管理学生信息,更好的为学生服务,为学生提供更加方便的查询信息系统,开发一个学生信息管理系统是十分有必要的。

主要的功能

1)查询学生信息、成绩信息

2)添加学生信息、成绩信息

3)更改学生信息、成绩信息

4)删除学生信息、

5)查询班级信息、成绩信息

6)更改班级信息

7)删除班级信息

8)查询专业成绩信息

9)系统操作

1.2功能流程分析

.事项分析

本次设计中涉及到二个表,学生表和成绩表,二表的各数据项如下

学生表:学号、姓名、性别、年龄、班级、系别、专业

成绩表:学号、数学、英语、体育、物理、计算机

.流程分析

当用户输入用户名和密码后,如果是合法的用户则能进入学生信息管理系统,如果不是合法的用户则提示“错误的用户名或密码”。当用户进入系统之后则可

以进行管理操作,流程如下图所示。

2概念设计

实体分析

实体及相关属性

通过需求分析可知本系统包含三个实体,学生、管理员、成绩,三个实体的相关属性如下:

学生:学号(sno),姓名(sname),性别(sex),年龄(sage),班级(sclass),专业(smajor),系别(sdept)

成绩:学号(sno),高等数学(gmath),大学英语(genglish),大学体育(gsport),大学物理(gphysics),计算机(gcomputer)

管理员:ID (主码),姓名,密码

实体聚集图

3逻辑设计

3.1数据库初步构思框架

通过一般关系模型的原则分析,得到须在数据库中进行存储的一般关系模型如下(带下划线的为主码):

学生:学号(sno),姓名(sname),性别(sex),年龄(sage),班级(sclass),专业(smajor),系别(sdept)

成绩:学号(sno),高等数学(gmath),大学英语(genglish),大学体育(gsport),大学物理(gphysics),计算机(gcomputer)

3.2 具体逻辑模型设计

Student 表用来保存学生信息

Grade表用来保存学生成绩信息

4物理设计

根据表的结构关系,本系统采用SQL Server 2008数据库。SQL Server 2008是微软公司关系型数据库产品,它是在由MS SQL Server 7.0建立的坚固基础之上产生的。客户的需求极大的推动了该产的革新,SQL Server2008在易用性、可缩放性和可靠性,以及数据仓库等诸多方面有了很大的增强。这使得SQL Server 2008在很多数据库产品发展最快的应用领域(如电子商务、移动计算、分支自动化、商业级应用和数据交换中心等)中成为领先者在数据库中创建表的同时须创建相关的索引。索引就是加快检索表中数据的方法。数据库的索引类似于书籍的索引。在书籍中,索引允许用户不必翻阅完整个书就能迅速地找到所需要的信息。在数据库中,索引也允许数据库程序迅速地找到表中的数据,而不必扫描整个数据库。本数据库表较为简单,且每个表中定义主键约束或者唯一性键约束,已经间接创建了索引,故无需再创建索引。

5 功能模块设计

5.1主模块设计

当操作人员输入合法的用户名和密码后,就可以进入学生信息管理的主界面进行相关的操作,当用户名或密码不正确时系统会提示“不正确的用户名或密码!”则操作人员不能进入学生信息管理系统的主界面,不能进行相关的操作。

流程如下图:

5.2相关子模块的设计

5.2.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;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form1login : Form

{

public Form1login()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

SQLHelper helper = new SQLHelper();

inttotal=helper.login(textBoxusername.Text.Trim(),

textBoxpassword.Text.Trim());

if (total >0)

{

Form2main main = new Form2main();

main.Show();

this.Hide();

}

else

{

MessageBox.Show("错误的用户名或密码!", "警告"

MessageBoxButtons.OK);

textBoxusername.Text = "";

textBoxpassword.Text = "";

textBoxusername.Focus();

}

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

5.2.2主界面模块

当操作人员输入合法的用户名和密码后就进入了主界面,可以进行相关操作

相关流程如下图:

部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form2main : Form

{

public Form2main()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

public void bind()

{

bs.DataSource = new SQLHelper().CreateTable();

dataGridView1.DataSource = bs;

}

public void bind2()

{

bs.DataSource = new SQLHelper().CreateTable2();

dataGridView1.DataSource = bs;

}

private void 查询ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form4selectstudent select = new Form4selectstudent();

select.ShowDialog();

}

private void 添加ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form3addstudent add= new Form3addstudent();

add.ShowDialog();

if (add.DialogResult == DialogResult.OK)

{

bind();

}

}

private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form5deletestudent delete = new Form5deletestudent();

delete.ShowDialog();

if (delete.DialogResult == DialogResult.OK)

{

bind();

}

}

private void 班级成绩ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form6addgrade add = new Form6addgrade();

add.ShowDialog();

if (add.DialogResult == DialogResult.OK)

{

bind2();

}

}

private void 学生ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form7selectgrade select = new Form7selectgrade();

select.ShowDialog();

}

private void 班级成绩ToolStripMenuItem1_Click(object sender,

EventArgs e)

{

Form8selectclassgrade select = new Form8selectclassgrade();

select.ShowDialog();

}

private void 专业成绩ToolStripMenuItem1_Click_1(object sender,

EventArgs e)

{

Form9selectmajor select = new Form9selectmajor();

select.ShowDialog();

}

private void 查询ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form10selectclass select = new Form10selectclass();

select.ShowDialog();

}

private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form11deleteclass select = new Form11deleteclass();

select.ShowDialog();

}

private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)

{

Application.Exit();

}

private void 登录ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form1login login = new Form1login();

login.ShowDialog();

}

private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form12updatastudent updata = new Form12updatastudent();

updata.ShowDialog();

}

private void 修改ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form13updateclass updata = new Form13updateclass();

updata.ShowDialog();

}

private void 修改ToolStripMenuItem2_Click(object sender, EventArgs e)

{

Form14updategrade update = new Form14updategrade();

update.ShowDialog();

}

}

}

5.2.3学生信息管理模块

当用户进入学生信息管理系统之后就可以对学生信息进行管理,可以查询学生信息、添加学生信息、修改学生信息、删除学生信息。每次操作时用户都要输入要操作学生的学号,完成操作后系统会提示相关操作成功,当未输入学号时,系统会提示“学号不能为空!”

相关流程如下图:

1 添加学生信息部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form3addstudent : Form

{

public Form3addstudent()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox1.Text.Trim() != "")

{

string 学号 = textBox1.Text.Trim();

string 姓名 = textBox2.Text.Trim();

string 年龄 = textBox3.Text.Trim();

string 性别 = comboBox2.Text.Trim();

string 班级 = textBox4.Text.Trim();

string 系别 = comboBox1.Text.Trim();

string 专业 = comboBox3.Text.Trim();

new studentDAO().insert(学号, 姓名, 年龄, 性别, 班级, 系别, 专业);

MessageBox.Show("添加成功!");

textBox1.Text = "";

textBox2.Text = "";

textBox3.Text = "";

comboBox2.Text = "";

textBox4.Text = "";

comboBox1.Text = "";

comboBox3.Text = "";

this.DialogResult = DialogResult.OK;

messageBox.show("添加成功!");

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

2 删除学生信息部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form5deletestudent : Form

{

public Form5deletestudent()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBoxsno.Text.Trim() != "")

{

string sno = textBoxsno.Text.Trim();

new studentDAO().delete(sno);

MessageBox.Show("删除成功", "提示",

MessageBoxButtons.OK);

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

3 查找学生信息部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form4selectstudent : Form

{

public Form4selectstudent()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

private void button2_Click(object sender, EventArgs e)

{

if (textBoxsno .Text .Trim ()!="")

{

bs.DataSource = new studentDAO().select(textBoxsno.Text.Trim());

dataGridView1.DataSource = bs;

MessageBox.Show("查询成功!");

}

else

MessageBox.Show ("学号不能为空!");

}

private void button1_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

4 修改学生信息部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form12updatastudent : Form

{

public Form12updatastudent()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox6.Text.Trim() != "")

{

string 学号 = textBox6.Text.Trim();

string 姓名 = textBox2.Text.Trim();

string 性别 = comboBox3.Text.Trim();

string 年龄 = textBox4.Text.Trim();

string 班级 = textBox5.Text.Trim();

string 系别 = comboBox1.Text.Trim();

string 专业 = comboBox2.Text.Trim();

new studentDAO().updatastudent(学号, 姓名, 年龄, 性别,

, 系别, 专业);

MessageBox.Show("修改成功!");

textBox6.Text = "";

textBox2.Text = "";

comboBox3.Text = "";

textBox4.Text = "";

textBox5.Text = "";

comboBox1.Text = "";

comboBox2.Text = "";

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

5.2.4班级信息管理模块

用户进入主界面后可以对班级进行管理,相关操作有查询班级信息、修改班级信息、删除班级信息。查询班级信息将用户输入的班级的信息以表的形式输出,

并提示用户“查询成功!”,修改班级信息将会修改所有满足条件的学生的班级,并提示用户“修改成功!”,删除班级信息将删除所有满足条件的学生信息,并提示用户“删除成功!”。当用户未输入班级的相关信息时,系统会提示“请输入完整的信息!”

相关流程如下图:

查询班级信息部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form10selectclass : Form

{

public Form10selectclass()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

private void button1_Click(object sender, EventArgs e)

{

if( comboBox1sdept.Text.Trim()!=""&&

comboBox2smajor.Text.Trim()!=""&&

textBox3sclass.Text.Trim() != "")

{

bs.DataSource=newstudentDAO().selectclass(comboBox1sdept.Text.Trim(),

comboBox2smajor.Text.Trim(), textBox3sclass.Text.Trim());

dataGridView1.DataSource = bs;

messageBox.show("查询成功!");

}

else

MessageBox.Show("请输入完整的信息!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

5.2.5成绩信息管理模块

当用户进入主界面后可以对成绩进行管理,相关操作有添加成绩、查询成绩、修改成绩;而在查询成绩中又包含查询学生成绩、查询班级成绩、查询专业成绩

在添加成绩时,要输入要添加的学生的学号,添加完成后系统会提示“添加完成!”,如果未输入学号操作则提示“学号不能为空!”。查询成绩则根据选择的查询类型输入相关信息。如选择查询班级成绩,则提示输入相关班级的信息。修改成绩则要输入要修改学生的学号。

相关流程图如下:

修改成绩部分代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form14updategrade : Form

{

public Form14updategrade()

{

InitializeComponent();

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox1.Text.Trim() != "")

{

string 学号 = textBox1.Text.Trim();

string 高等数学 = textBox2.Text.Trim();

string 大学英语 = textBox3.Text.Trim();

string 计算机 = textBox4.Text.Trim();

string 大学物理 = textBox5.Text.Trim();

string 大学体育 = textBox6.Text.Trim();

new studentDAO().updategrade(学号, 高等数学 , 大学英语 , 计算

, 大学物理, 大学体育);

MessageBox.Show("修改成功!");

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

}

}

6 功能运行截图

6.1登录系统界面

6.2学生信息管理系统界面

6.3学生信息管理界面

6.3.1添加学生信息界面

6.3.2删除学生信息界面

6.3.3查找学生信息界面

6.3.4修改学生信息界面

6.4班级信息管理界面

6.4.1查找班级信息界面

6.4.2删除班级信息界面

6.4.3修改班级信息界面

6.5成绩信息管理界面

6.5.1添加学生成绩

6.5.2查询学生成绩界面

6.5.3修改学生成绩界面

7 课程设计总结

本学期所做的课程设计与上一学期的课程设计相比,难度加大了不少,对于我们来说是个不小的挑战。在做课程设计的过程中,有成功但更多的是有地方出现错误。当指令运行成功时,我会感到成就感,会更有动力去完成下面的工作。当然,对于初学者而言,我要面对更多的是指令出现错误,这时真的会感觉到很头疼,错误有大有小,当遇到自己无法解决的错误时,这是我们可以寻求老师,同学的帮助,可以在百度搜索解决问题的方法,也可以去图书馆查看相关的资料,方法有很多,关键是我们要有决心解决困难。总而言之,通过这次课程设计,我获益匪浅,丰富了专业知识的同时也锻炼了我面对困难解决困难的决心。

8 结束语

在这次课程设计中,首先要感谢王磊老师教给了我们丰富的专业知识,在我们遇到困难时,耐心的为我们分析错误的原因,帮助我们解决困难。在一次上机操作课上,老师向我强调了使用百度,google等搜索引擎解决困难的重要性,感谢王老师对我们的教育。

[1] 王珊,萨师煊.数据库系统概论(第四版).北京:高等教育出版社

[2] 刘启原.数据库与信息系统的安全.北京:科学出版社

[3] 王珊,冯念真.计算机应用系统的设计和开发.北京:高等教育出版社

[4] 姚卿达.数据库设计.北京:高等教育出版社

[5] 萨师煊.数据库的理论与实践.计算机科学

[6] 萨师煊.数据库系统和系统分析.计算机工程与设计

[7] 王珊,萨师煊.数据库设计理论与实践.计算机应用与软件

附录:程序清单

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;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form1login : Form

{

public Form1login()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

SQLHelper helper = new SQLHelper();

int total = helper.login(textBoxusername.Text.Trim(),

textBoxpassword.Text.Trim());

if (total >0)

{

Form2main main = new Form2main();

main.Show();

this.Hide();

}

else

{

MessageBox.Show("错误的用户名或密码!", "警告"

MessageBoxButtons.OK);

textBoxusername.Text = "";

textBoxpassword.Text = "";

textBoxusername.Focus();

}

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form2main : Form

{

public Form2main()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

public void bind()

{

bs.DataSource = new SQLHelper().CreateTable();

dataGridView1.DataSource = bs;

}

public void bind2()

{

bs.DataSource = new SQLHelper().CreateTable2();

dataGridView1.DataSource = bs;

}

private void 查询ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form4selectstudent select = new Form4selectstudent();

select.ShowDialog();

}

private void 添加ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form3addstudent add= new Form3addstudent();

add.ShowDialog();

if (add.DialogResult == DialogResult.OK)

{

bind();

}

}

private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form5deletestudent delete = new Form5deletestudent();

delete.ShowDialog();

if (delete.DialogResult == DialogResult.OK)

{

bind();

}

}

private void 班级成绩ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form6addgrade add = new Form6addgrade();

add.ShowDialog();

if (add.DialogResult == DialogResult.OK)

{

bind2();

}

}

private void 学生ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form7selectgrade select = new Form7selectgrade();

select.ShowDialog();

}

private void 班级成绩ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form8selectclassgrade select = new Form8selectclassgrade();

select.ShowDialog();

}

private void 专业成绩ToolStripMenuItem1_Click_1(object sender, EventArgs e)

{

Form9selectmajor select = new Form9selectmajor();

select.ShowDialog();

}

private void 查询ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form10selectclass select = new Form10selectclass();

select.ShowDialog();

}

private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form11deleteclass select = new Form11deleteclass();

select.ShowDialog();

}

private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)

{

Application.Exit();

}

private void 登录ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form1login login = new Form1login();

login.ShowDialog();

}

private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form12updatastudent updata = new Form12updatastudent();

updata.ShowDialog();

}

private void 修改ToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form13updateclass updata = new Form13updateclass();

updata.ShowDialog();

}

private void 修改ToolStripMenuItem2_Click(object sender, EventArgs e)

{

Form14updategrade update = new Form14updategrade();

update.ShowDialog();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form3addstudent : Form

{

public Form3addstudent()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox1.Text.Trim() != "")

{

string 学号 = textBox1.Text.Trim();

string 姓名 = textBox2.Text.Trim();

string 年龄 = textBox3.Text.Trim();

string 性别 = comboBox2.Text.Trim();

string 班级 = textBox4.Text.Trim();

string 系别 = comboBox1.Text.Trim();

string 专业 = comboBox3.Text.Trim();

new studentDAO().insert(学号, 姓名, 年龄, 性别, 班级, 系别

专业);

MessageBox.Show("录入成功!");

textBox1.Text = "";

textBox2.Text = "";

textBox3.Text = "";

comboBox2.Text = "";

textBox4.Text = "";

comboBox1.Text = "";

comboBox3.Text = "";

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form4selectstudent : Form

{

public Form4selectstudent()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

private void button2_Click(object sender, EventArgs e)

{

if (textBoxsno .Text .Trim ()!="")

{

bs.DataSource = new studentDAO().select(textBoxsno.Text.Trim());

dataGridView1.DataSource = bs;

MessageBox.Show("查询成功!");

}

else

MessageBox.Show ("学号不能为空!");

}

private void button1_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form5deletestudent : Form

{

public Form5deletestudent()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBoxsno.Text.Trim() != "")

{

string sno = textBoxsno.Text.Trim();

new studentDAO().delete(sno);

MessageBox.Show("删除成功", "提示",

MessageBoxButtons.OK);

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form6addgrade : Form

{

public Form6addgrade()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox1.Text.Trim() != "")

{

string 学号 = textBox1.Text.Trim();

string 高等数学 = textBox3.Text.Trim();

string 大学英语 = textBox4.Text.Trim();

string 计算机 = textBox5.Text.Trim();

string 大学体育 = textBox6.Text.Trim();

string 大学物理 = textBox7.Text.Trim();

new studentDAO().insert2(学号, 高等数学, 大学英语, 计算机,

大学体育, 大学物理);

MessageBox.Show("录入成功!");

textBox1.Text = "";

textBox3.Text = "";

textBox4.Text = "";

textBox5.Text = "";

textBox6.Text = "";

textBox7.Text = "";

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form7selectgrade : Form

{

public Form7selectgrade()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

private void button1_Click(object sender, EventArgs e)

{

if (textBoxsno.Text.Trim() != "")

{

bs.DataSource=newstudentDAO().selectgrade(textBoxsno.Text.Trim());

dataGridView1.DataSource = bs;

MessageBox.Show("查询成功!");

}

else

MessageBox.Show("学号不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form9selectmajor : Form

{

public Form9selectmajor()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

private void button1_Click(object sender, EventArgs e)

{

if (comboBox1.Text.Trim() != "" && comboBox2.Text.Trim() != "")

{

bs.DataSource=

new studentDAO().selectmajorgrade(comboBox1.Text.Trim(),

comboBox2.Text.Trim());

dataGridView1.DataSource = bs;

MessageBox.Show("查询成功!");

}

else

MessageBox.Show("系别或专业不能为空!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form10selectclass : Form

{

public Form10selectclass()

{

InitializeComponent();

}

BindingSource bs = new BindingSource();

private void button1_Click(object sender, EventArgs e)

{

if(comboBox1sdept.Text.Trim()!=""&&

comboBox2smajor.Text.Trim()!=""&& textBox3sclass.Text.Trim() != "")

{

bs.DataSource=

new studentDAO().selectclass(comboBox1sdept.Text.Trim(),

comboBox2smajor.Text.Trim(), textBox3sclass.Text.Trim());

dataGridView1.DataSource = bs;

}

else

MessageBox.Show("请确认输入完整的信息!");

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form13updateclass : Form

{

public Form13updateclass()

{

InitializeComponent();

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

private void button1_Click(object sender, EventArgs e)

{

if (comboBox1.Text.Trim() != "" && comboBox2.Text.Trim() != ""

&& textBox1.Text.Trim() != "")

{

string 系别 = comboBox1.Text.Trim();

string 专业 = comboBox2.Text.Trim();

string 班级 = textBox1.Text.Trim();

string 新系别 = comboBox3.Text.Trim();

string 新专业 = comboBox4.Text.Trim();

string 新班级 = textBox2.Text.Trim();

new studentDAO().updateclass(系别, 专业, 班级, 新系别,

专业, 新班级);

MessageBox.Show("修改成功!");

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("请输入完整的信息!");

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using DAL;

namespace WindowsstudentMIS

{

public partial class Form14updategrade : Form

{

public Form14updategrade()

{

InitializeComponent();

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox1.Text.Trim() != "")

{

string 学号 = textBox1.Text.Trim();

string 高等数学 = textBox2.Text.Trim();

string 大学英语 = textBox3.Text.Trim();

string 计算机 = textBox4.Text.Trim();

string 大学物理 = textBox5.Text.Trim();

string 大学体育 = textBox6.Text.Trim();

new studentDAO().updategrade(学号, 高等数学 , 大学英语 , 计算

, 大学物理, 大学体育);

MessageBox.Show("修改成功!");

this.DialogResult = DialogResult.OK;

}

else

MessageBox.Show("学号不能为空!");

}

}

}

本文来源:https://www.2haoxitong.net/k/doc/13a3343565ce050877321359.html

《C#学生信息管理系统.doc》
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档

文档为doc格式