党员档案管理系统数据库课程设计含代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
攀枝花学院本科数据库课程设计报告
[学生党员管理系统开发]
学生姓名:
学生学号:
院(系)
年级专业:
指导教师:职称:
2014年12月12日
攀枝花学院本科学生课程设计任务书
注:任务书由指导教师填写。
摘要
学生党员信息管理系统目的是为减轻教师工作负担、提高工作效率,也方便学生查询等,是传统全人工化管理模式所无法披靡的。
系统选用的开发软件是visual studio 2010,后台数据库为SQL Server2008企业版,通过前者提供的各种面向对象,尤其是数据窗口这一功能方便而简洁操纵数据库的智能化对象,以及后者的数据一致性和完整性强、数据安全性好等特点。
我们在短时间内建立系统应用原型,然后,对初始原型系统进行需求迭代,其中系统整体外观设计以及登入的成功与否是本论文的关键。
通过对学生党员信息管理系统的需求进行了详细调查分析,设计了一个学生党员信息管理系统的开发方案,用SQL Server数据库和技术构建,不断修正和改进,直到形成令人满意的可行性学生党员信息管理系统。
关键词:学生党员信息管理系统,visual studio 2010,SQL Server2008
目录
课程设计任务书 (Ⅰ)
成绩评定表 (Ⅱ)
摘要 (Ⅲ)
一绪论 (1)
1.1系统开发的意义 (1)
1.2选题背景 (1)
1.3课题 (1)
二系统的需求分析 (2)
2.1可行性分析 (2)
2.2经济可行性分析 (2)
2.3基本性能要求 (2)
三系统总体设计 (3)
3.1系统业务流程图 (3)
3.2数据库设计 (3)
3.2.1数据库概念结构设计 (3)
3.2.2数据库逻辑结构设计 (4)
四系统详细模块设计与测试 (5)
4.1登录界面设计 (5)
4.2主界面模块设计 (5)
4.3添加学生党员模块设计 (5)
4.4信息统计 (6)
4.5信息查询 (6)
4.6信息删除 (6)
4.7信息修改 (7)
五数据库的创建 (7)
六总结 (9)
参考文献................................................................................................. 错误!未定义书签。
附录......................................................................................................... 错误!未定义书签。
一、绪论
1.1系统开发的意义
学生党员管理系统是学校党委组织工作不可缺少的一部分.一个功能齐全、简单易用的学生党员管理系统能有效地减轻党员管理工作人员的工作负担,提高工作效率。
随着经济的发展,人员交流来往的频繁,党员管理更加需要一套信息系统以提高信息管理的快捷及准确性。
为此,建立一个学生党员管理的信息库,把所有学生党员的信息,包括流动学生党员的信息全部保存在信息库存中,以便于管理、查询、统计等就显得尤为重要了。
本设计的研究目标就是要开发一个高校学生党员管理系统,对党员的基本信息进行管理,以减轻管理人员的工作负担。
本系统将采用B/S模式,基于sqlsever2008和visual studio 2010系统技术实现。
1.2选题背景
随着科学技术的发展,计算机管理在日常生活中的地位变得越来越重要。
它能够代替人做各种重复,繁琐的劳动,并且拥有操作简单,可信度好,不易出错等优点,大大减少了不必要的人力消耗,提高个人的工作效率。
学生党员日常管理是每个学校必须面临的问题,所以,如何开发一个简单易用,界面友好,容易操作,数据安全性好,可靠性高的管理系统就成为非常重要的技术问题。
我采用SQLServer技术进行数据库开发可以使开发过程简单化,更快捷的访问数据库。
1.3 课题
学生党员管理系统开发
本课题主要考虑的是提供简单方便的操作,为管理人员提供简单、高效的对党员信息的管理等。
二、系统需求分析
2.1可行性分析
根据用户需求可以将该系统的用户分为普通用户与管理员用户两种。
管理员登录该系统以后可以实现对该系统的管理与维护。
该系统主要功能包括对学生党员的信息进行添加,删除,修改以及一些特定条件的快捷查询,其中特定条件的查询包括按照学号进行快捷查询。
本系统还可以实现对该系统用户进行管理主要功能包括对用户的信息进行添加,修改,删除。
最后本系统还可以实现对用户角色的管理,通过该系统可以为不同的用户设置不同的角色。
2.2经济可行性
随着科学技术的发展和人们生活水平的不断提高,计算机的价格也已经越来越能被很多人所接受。
不管是在企业还是家庭,计算机的使用已经成为普遍现象。
所以从用户经济方面考虑,本系统的开发不会有很大的困难和风险,且系统本身成本较低,不需要很多的开发费用和以后的维护费用。
2.3基本性能要求:
登录功能设计:管理员(可以查看或者操作所有信息)功能模块。
用户管理:对本系统的用户信息进行操作或者管理(查询,添加,删除,更新)。
党员管理:对该校全体学生党员的基本信息进行管理(查询,添加,删除,更新)。
(1)学生党员信息的管理;能够增加、修改和删除学生党员的基本信息;(2)查询党员的基本信息:能够按照查询条件(班级、年级、专业、入党时间)查询党员的数量;也能够实现多个条件的组合查询
(3)统计党员的基本信息:统计按照查询条件(班级、年级、专业、入党时间)查询党员的数量;
三、系统总体设计
3.1系统业务流程图
党员信息管理系统设计与开发
3.2数据库设计
3.2.1数据库概念结构设计 用户登录E-R
学生党员信息E-R图:
3.2.2 数据库逻辑结构设计
用户信息表
学生党员信息表
四、系统详细模块设计与测试
4.1登录界面设计
4.2主界面模块设计
4.3添加学生党员模块设计
4.4信息统计4.5信息查询4.6信息删除
4.7信息修改
五、数据库的创建与维护
5.1数据库的创建
利用SQLServer 2008 创建yangbiao数据库,在数据库中创建用户表和党员信息数据表。
用户表:
信息表:
Create database yangbiao
USE [yangbiao]
GO
/****** Object: Table [dbo].[用户表] Script Date: 12/11/2014 11:30:10
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[用户表](
[UserName] [nchar](10) NULL,
[password] [nchar](10) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[信息表] Script Date: 12/11/2014 11:30:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[信息表](
[name] [nchar](10) NULL,
[sno] [nchar](10) NOT NULL,
[sex] [nchar](10) NULL,
[age] [int] NULL,
[class] [nchar](10) NULL,
[nation] [nchar](10) NULL,
[native] [nchar](10) NULL,
[type] [nchar](10) NULL,
CONSTRAINT [PK_信息表] PRIMARY KEY CLUSTERED
(
[sno] ASC
)WITH(PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF, IGNORE_DUP_KEY=OFF,ALLOW_ROW_LOCKS=ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
六、总结
在本次课程设计过程中,学到了很多知识,由于考试临近,时间冲突,设计进行的比较晚,所以功能比较差些,也未能进行更深入的思考,在运用方面也有所欠缺,数据库方面,整体考虑也还可以更全面、周到。
本次设计是用ASP和SQL SERVER2008进行的,由于ASP和SQL都是本学年就进行过系统的学习,所以做起来相对较为容易,但其中也遇到了一些困难。
总的来说,通过这一次的练习,巩固了ASP和SQL的许多知识,也提高了自己的差错纠错的能力,锻炼了我的耐心。
这也让我意识到了理论联系实际的重要性。
通过本次课程设计中,我还认识到:任何系统的完成,工程的开始都是最为关键的。
俗话说,万丈高楼平地起。
这就要求我们要做好需求分析,研究好每个细节,做到全面地了解整个系统实施,做好进度计划,严格按照时间表来执行,不拖拉,这样后面的工作才能顺利高效地展开,尽可能地避免返工,在时间计划内按时完成。
尽管本次设计还是借鉴了一些网络资源,但大部分内容都是自己完成的,按照自己的设想,我独立完成了概念结构设计、逻辑结构设计,和数据库的搭建、连接等工作,虽然设计时间并不长,但自己的能力仍然获得了很好的锻炼。
参考文献
[1]杨昭等,《数据库技术课程设计案例精编》,中国水利水电出版社,2006年1
月.
[2]潘文林,《数据库应用系统开发案例与实践教程》,清华大学出版社,2005
年9月.
[3]段明辉.ASP编程实例入门与提高[M].电子工业出版社,2004年.
[4]赵松涛.ASP动态网站开发实录[M].电子工业出版社,2006年.
[5]邓良松,刘海岩, 陆丽娜《软件工程》(第二版)西安电子科技大学出版. 2000
年11月.
[6]张莉《SQL SEVER数据库原理及应用》
[7]萨师煊王珊著.《数据库系统概论》第三版.高等教育出版社
[8] 施伯乐、丁宝康、汪卫.《数据库系统教程》高等教育出版社2003年第2版
[9]庄成三等.《数据库系统原理及其应用》.电子工业出版社
附录
登录程序代码:
using System;
using System.Collections.Generic;
using ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace党员管理系统
{
public partial class login : Form
{
public login()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string userName = textBox1.Text;
string password = textBox2.Text;
string connString = aaaaa.getstring();
SqlConnection conn = new SqlConnection(connString);
string sql = String.Format("select count(*) from 用户表
where UserName='{0}'and password='{1}'", userName, password);
try
{
conn.Open();
SqlCommand comm = new SqlCommand(sql, conn); ó
int n = (int)comm.ExecuteScalar();
//int n = 1;
if (n==1)
{
this.DialogResult = DialogResult.OK;
this.Tag = true;
}
else
{
MessageBox.Show("您输入的用户名或密码错误!请重试", "登录失败",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
this.Tag = false;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "操作数据库出错!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
this.Tag = false;
}
finally
{
conn.Close();
}
/*
this.DialogResult = DialogResult.OK;
this.Tag = true;
* */
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox1.Focus();
}
private void login_Load(object sender, EventArgs e)
{
}
}
}
主界面程序代码:
using System;
using System.Collections.Generic;
using ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace党员管理系统
{
public partial class MainFor : Form
{
private bool isLogined = false;
public MainFor()
{
InitializeComponent();
}
private void退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void用户登录ToolStripMenuItem_Click(object sender, EventArgs e)
{
login lForm = new login();
tssMsg.Text = lForm.Text;
if (lForm.ShowDialog() == DialogResult.OK)
{
if ((bool)lForm.Tag)
{
isLogined = true;
tssMsg.Text = "恭喜您,已经成功登录系统!";
}
else
{
isLogined = false;
tssMsg.Text = "注意!必须先登录才能使用本系统";
}
}
}
private void党员信息管理oolStripMenuItem_Click(object sender, EventArgs e) {
if (isLogined)
{
Base b = new Base();
b.MdiParent = this;
b.Show();
tssMsg.Text = b.Text;
}
else
tssMsg.Text = "注意!必须先登录才能使用本系统";
}
private void添加党员信息ToolStripMenuItem_Click(object sender, EventArgs e) {
if (isLogined)
{
ADD a = new ADD();
a.MdiParent = this;
a.Show();
tssMsg.Text = a.Text;
}
else
tssMsg.Text = "注意!必须先登录才能使用本系统";
}
private void统计ToolStripMenuItem_Click(object sender, EventArgs e) {
if (isLogined)
{
count c = new count();
c.MdiParent = this;
c.Show();
tssMsg.Text = c.Text;
}
else
tssMsg.Text = "注意!必须先登录才能使用本系统";
}
private void MainFor_Load(object sender, EventArgs e)
{
}
}
}
添加党员程序代码:
using System;
using System.Collections.Generic;
using ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace党员管理系统
{
public partial class ADD : Form
{
public ADD()
{
InitializeComponent();
}
private void ADD_Load(object sender, EventArgs e)
{
rdoMale.Checked = true;
}
private void button1_Click(object sender, EventArgs e)
{ string sex = "";
if (rdoMale.Checked)
sex = rdoMale.Text;
else
sex = rdoFemale.Text;
string type = comboBox1.SelectedItem.ToString();
string connString = aaaaa.getstring();
string sql = String.Format("INSERT INTO 信息表
name,sno,sex,age,class,nation,native,type)VALUES('{0}','{1}','{2}','{3}','{4}','{5}', '{6}','{7}')", textBox1.Text, textBox2.Text, sex, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, type);//SQL语句
using (SqlConnection conn = new SqlConnection(connString))
{
try
{ conn.Open(); //打开数据库连接
SqlCommand comm = new SqlCommand(sql, conn); //创建 Command 对象
SqlParameter sqlpara = new SqlParameter();
int n = comm.ExecuteNonQuery();
if (n > 0)
{
MessageBox.Show("添加学生信息成功", "添加成功",
MessageBoxButtons.OK, rmation);
}
else
{
MessageBox.Show("添加学生信息失败", "添加失败",
MessageBoxButtons.OK, rmation);
}
}
catch (Exception ex)
{ MessageBox.Show(ex.Message);
}
}
}
private void button2_Click(object sender, EventArgs e)
{ this.Close();
}
}
}
查询、删除、修改党员程序代码:
using System;
using System.Collections.Generic;
using ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace党员管理系统
{
public partial class Base : Form
{
ToolStripItem tsb;
ToolStripItem mi;
public Base()
{
InitializeComponent();
}
public Base(ToolStripItem tsb, ToolStripItem mi)
{
InitializeComponent();
this.tsb = tsb;
this.mi = mi;
}
private void Base_FormClosed(object sender, FormClosedEventArgs e) {
tsb.Enabled = true;
mi.Enabled = true;
}
private string connstring = aaaaa.getstring();
private void button2_Click_1(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(connstring);
string sqlString = @"select * from [信息表]";
SqlDataAdapter da = new SqlDataAdapter(sqlString, conn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet, "信息表");
myDataSet.Tables["信息表"].PrimaryKey = new DataColumn[] { myDataSet.Tables["信息表]".Columns["Sno"] };
dataGridView1.DataSource = myDataSet.Tables["信息表"];
}
private void button1_Click_1(object sender, EventArgs e)
{
string Sno =textBox1.Text;
SqlConnection conn = new SqlConnection(connstring);
string sqlString = @"select * from [信息表]where SNO='" + Sno + "'";
SqlDataAdapter da = new SqlDataAdapter(sqlString, conn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet, "信息表)";
myDataSet.Tables["信息表"].PrimaryKey = new DataColumn[]
{ myDataSet.Tables["信息表]".Columns["Sno"] };
dataGridView1.DataSource = myDataSet.Tables["信息表"];
}
private void button5_Click_1(object sender, EventArgs e)
{
string stNo = txtNo2.Text;
SqlConnection conn = new SqlConnection(connstring);
string sqlString = @"select * from [信息表];
SqlDataAdapter da = new SqlDataAdapter(sqlString, conn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet, "信息表");
myDataSet.Tables["信息表]".PrimaryKey = new DataColumn[]
{ myDataSet.Tables["信息表"].Columns["Sno"] };
DataRow dr = myDataSet.Tables["信息表"].Rows.Find(stNo);
if (dr == null)
{
MessageBox.Show("学号为" + stNo + "的学生在数据库中不存在");
return;
}
txtNo2.Text = dr["SNO"].ToString();
txtName2.Text = dr["Name"].ToString();
txtSEX2.Text = dr["Sex"].ToString();
txtClass.Text = dr["Class"].ToString();
txtAGE2.Text = dr["AGE"].ToString();
textNation.Text = dr["Nation"].ToString();
texNative.Text = dr["Native"].ToString();
comType.Text = dr["Type"].ToString();
}
private void button6_Click_1(object sender, EventArgs e)
{
string Sno = txtNo2.Text;
SqlConnection conn = new SqlConnection(connstring);
string sqlString = @"select * from [信息表];
SqlDataAdapter da = new SqlDataAdapter(sqlString, conn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet, "信息表");
myDataSet.Tables["信息表"].PrimaryKey = new DataColumn[]
{ myDataSet.Tables["信息表括"].Columns["sno"] };
DataRow dr = myDataSet.Tables["信息表"].Rows.Find(Sno);
if (dr == null)
{
MessageBox.Show("学号为" + Sno + "的学生在数据库中不存在");
return;
}
myDataSet.BeginInit();
dr["Sno"] = txtNo2.Text;
dr["Name"] = txtName2.Text;
dr["Sex"] = txtSEX2.Text;
dr["Class"] = txtClass.Text;
dr["Age"] = txtAGE2.Text;
dr["Nation"] = textNation.Text;
dr["Native"] = texNative.Text;
dr["Type"] = comType.Text;
myDataSet.EndInit();
SqlCommandBuilder sqlBuild = new SqlCommandBuilder(da);
da.UpdateCommand = sqlBuild.GetUpdateCommand();
try
{
da.Update(myDataSet, "信息表");
myDataSet.AcceptChanges();
MessageBox.Show("更新成功!");
}
catch (Exception ex)
{
MessageBox.Show("更新出错!错误原因是:\n" + ex.Message + "\\n"); }
dataGridView1.DataSource = myDataSet.Tables["信息表"];
}
private void button4_Click_1(object sender, EventArgs e)
{
string Sno = txtSNo.Text;
SqlConnection conn = new SqlConnection(connstring);
string sqlString = @"select * from [信息表];
SqlDataAdapter da = new SqlDataAdapter(sqlString, conn);
DataSet myDataSet = new DataSet();
da.Fill(myDataSet, "信息表");
myDataSet.Tables["信息表"].PrimaryKey = new DataColumn[]
{ myDataSet.Tables["信息表"].Columns["Sno"] };
DataRow dr = myDataSet.Tables["信息表"].Rows.Find(Sno);
dr.Delete();
SqlCommandBuilder sqlBuild = new SqlCommandBuilder(da);
da.DeleteCommand = sqlBuild.GetDeleteCommand();
try
{
da.Update(myDataSet, "信息表括");
myDataSet.AcceptChanges();
MessageBox.Show("删除成功!");
}
catch (Exception ex)
{
MessageBox.Show("删除出错!错误原因是:\n" + ex.Message + "\n"); }
dataGridView1.DataSource = myDataSet.Tables["信息表"];
}
}
}
添加党员程序代码:
using System;
using System.Collections.Generic;
using ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
using mon;
namespace党员管理系统
{
public partial class count : Form
{
public count()
{
InitializeComponent();
}
private void count_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string c = comboBox1.Text;
string cc = textBox1.Text;
string connstring = @"Data Source=DELL-PC\MINKE;Initial
Catalog=yangbiao;Integrated Security=True";
string sql1="";
if(c=="全部统计")
{ sql1 = String.Format("select count(*) from 信息表);
}
else if(c=="按班级统计")
{
sql1 = String.Format("select count(*) from 信息表where class='{0}'",cc); }
else if (c == "按年龄统计")
{
sql1 = String.Format("select count(*) from 信息表
where age={0}",cc.ToString());
}
SqlConnection conn = new SqlConnection(connstring);
try
{ conn.Open();
SqlCommand comm = new SqlCommand(sql1, conn);
int n = (int)comm.ExecuteScalar();
label3.Text = n.ToString();
}
finally
{ conn.Close();
}
}}}
Sql.cs代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace党员管理系统
{
public static class aaaaa
{
static string connString;
static aaaaa()
{ connString = @"Data Source=DELL-PC\MINKE;Initial Catalog=yangbiao;
Integrated Security=True";
}
public static string getstring()
{ return connString;
} }}。