




免费预览已结束,剩余21页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
课 程 设 计课程设计名称: 同学录设计与实现 专 业 班 级 : 学 生 姓 名 : 学 号 : 指 导 教 师 : 课程设计时间: 计算机科学与技术 专业课程设计任务书学生姓名专业班级学号题 目同学录的设计与实现课题性质其它课题来源自拟课题指导教师同组姓名无主要内容本系统具有以下功能:(1)利用c#编写程序,实现同学录数据的更新、添加、删除。每个同学的记录包括姓名、分组、手机号、固定电话、家庭住址、QQ等内容;(2)权限限制,只有输入正确的秘密才能进行相关的操作。任务要求综合运用所学的数据库基本知识,并能通过查阅相关文献材料,独立完成该课题的设计开发工作。设计同学录系统,进一步掌握通过编程访问数据库和对数据库的管理,用高级语言编写管理系统实现对同学录相关方面的管理。参考文献1詹英.数据库技术与应用M.北京:清华大学出版社.2008.9-142黄德才.数据库原理及其应用教程.M.北京:科学出版社.2007.12-33龚沛曾,杨志强. 数据库技术与应用M.北京 高等教育出版社.20084任满杰.数据库实用教程M.电子工业出版社.20065王珊,萨师煊.数据库系统概论M.高等教育出版社出版.2005审查意见指导教师签字:教研室主任签字: 年 月 日 1 需求分析主要实现的功能有,添加、删除、修改、查询、浏览、改密等。当选择首页面相应按钮,执行相应的操作。当选择添加、删除、修改这三个可能会更改数据库的按钮时,会跳出输入密码的窗体。只有输入正确的秘密才能进行操作。而查询、浏览不需要输入密码。2 概要设计Main窗体:登录时的首页面,包括全部功能的按钮,当按下相应按钮时执行相应的操作。添加 窗体:当用户点击首页面添加按钮时,跳出添加窗体。窗体包含,要添加同学的所有信息,当输入完毕后,按添加按钮进行添加。删除 窗体:当用户点击首页面删除按钮时,跳出删除窗体。当输入需要删除的同学姓名后,按确定按钮进行删除操作。修改 窗体:当用户点击首页面修改按钮时,跳出修改窗体。需要用户输入要修改同学的姓名,然后输入修改后的信息。按确定按钮完成修改。查询 窗体:当用户选择查询按钮时,跳出查询窗体。当用户输入同学姓名后,按下查询按钮,该同学的全部信息就会显示到相应的位置。浏览 窗体:当用户选择浏览按钮时,跳出浏览窗体。窗体里包含所有同学的信息。改密 窗体:当用户选择改密按钮时,跳出改密窗体。需要用户输入旧密码和两次输入新密码,然后按修改按钮完成改密。3 运行环境软件环境:XP 硬件环境:PC4 开发工具和编程语言开发工具:Micros visual studio 2008 编程语言:C#5 详细设计1.首页面代码:namespace 同学录 public partial class Main : Form public Main() InitializeComponent(); private void button1_Click(object sender, EventArgs e) 添加1 f = new 添加1(); f.Show(); private void button2_Click(object sender, EventArgs e) 删除1 f = new 删除1(); f.Show(); private void button3_Click(object sender, EventArgs e) 修改1 f = new 修改1(); f.Show(); private void button4_Click(object sender, EventArgs e) 查询 f = new 查询(); f.Show(); private void button5_Click(object sender, EventArgs e) 浏览 f = new 浏览(); f.Show(); private void Main_Load(object sender, EventArgs e) private void button6_Click(object sender, EventArgs e) Close(); private void button7_Click(object sender, EventArgs e) 改密 f = new 改密(); f.Show(); 2.查询功能实现:namespace 同学录 public partial class 查询 : Form public 查询() InitializeComponent(); private void button1_Click(object sender, EventArgs e) String str = Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True; SqlConnection conn = new SqlConnection(str); if (ConnectionState.Closed = conn.State) conn.Open(); String myselect = select * from txxx where 姓名=+textBox8.Text+; SqlDataAdapter adap = new SqlDataAdapter(myselect, conn); DataSet dts = new DataSet(); adap.Fill(dts); conn.Close(); textBox1.DataBindings.Add(Text, dts.Tables0, 姓名); textBox2.DataBindings.Add(Text, dts.Tables0, 分组); textBox3.DataBindings.Add(Text, dts.Tables0, 手机); textBox4.DataBindings.Add(Text, dts.Tables0, 固定电话); textBox5.DataBindings.Add(Text, dts.Tables0, 家庭住址); textBox6.DataBindings.Add(Text, dts.Tables0, QQ); textBox7.DataBindings.Add(Text, dts.Tables0, 其他资料); private void button2_Click(object sender, EventArgs e) Close(); private void 查询_Load(object sender, EventArgs e) 3.改密功能实现:namespace 同学录 public partial class 改密 : Form public 改密() InitializeComponent(); private void 改密_Load(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) int n = 0; String str = textBox1.Text.ToString().Trim(); String str1 = textBox2.Text.ToString().Trim(); String str2 = textBox3.Text.ToString().Trim(); SqlConnection conn = new SqlConnection(Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True); String sql = select * from mima; if (ConnectionState.Closed = conn.State) conn.Open(); SqlCommand comm = new SqlCommand(sql, conn); SqlDataReader read = comm.ExecuteReader(); while (read.Read() if (read0.ToString().Trim() = str) n = 1; if (n = 0) textBox1.Text = ; MessageBox.Show(旧密码不正确,请重新输入!); read.Close(); if (n = 1) if (str1 = str2) SqlDataAdapter d = new SqlDataAdapter(); String s = UPDATE mima SET m=+textBox2.Text+; d.UpdateCommand = new SqlCommand(s, conn); d.UpdateCommand.ExecuteNonQuery(); textBox2.Text = ; textBox3.Text = ; Close(); MessageBox.Show(改密成功); else MessageBox.Show(新密码不匹配!); textBox2.Text = ; textBox3.Text = ; conn.Close(); private void button2_Click(object sender, EventArgs e) Close(); 4.浏览功能实现:namespace 同学录 public partial class 浏览 : Form private BindingManagerBase mybind; public 浏览() InitializeComponent(); private void 浏览_Load(object sender, EventArgs e) String str = Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True; SqlConnection conn = new SqlConnection(str); if (ConnectionState.Closed = conn.State) conn.Open(); String myselect = select * from txxx; SqlDataAdapter adap = new SqlDataAdapter(myselect, conn); DataSet dts = new DataSet(); adap.Fill(dts); dataGridView1.DataSource = dts.Tables0; mybind = this.BindingContextdts.Tables0; conn.Close(); textBox1.DataBindings.Add(Text, dts.Tables0, 姓名); textBox2.DataBindings.Add(Text, dts.Tables0, 分组); textBox3.DataBindings.Add(Text, dts.Tables0, 手机); textBox4.DataBindings.Add(Text, dts.Tables0, 固定电话); textBox5.DataBindings.Add(Text, dts.Tables0, 家庭住址); textBox6.DataBindings.Add(Text, dts.Tables0, QQ); textBox7.DataBindings.Add(Text, dts.Tables0, 其他资料); private void button1_Click(object sender, EventArgs e) mybind.Position = 0; private void button2_Click(object sender, EventArgs e) mybind.Position = mybind.Position - 1; private void button3_Click(object sender, EventArgs e) mybind.Position = mybind.Position + 1; private void button4_Click(object sender, EventArgs e) mybind.Position = mybind.Count - 1; private void button5_Click(object sender, EventArgs e) Close(); 5.删除功能实现:namespace 同学录 public partial class 删除 : Form public 删除() InitializeComponent(); private void button1_Click(object sender, EventArgs e) String str = Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True; SqlConnection conn = new SqlConnection(str); if (ConnectionState.Closed = conn.State) conn.Open(); SqlDataAdapter d = new SqlDataAdapter(); d.DeleteCommand = new SqlCommand(DELETE from txxx where 姓名= + textBox1.Text + , conn); d.DeleteCommand.ExecuteNonQuery(); conn.Close(); textBox1.Text = ; private void 删除_Load(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e) Close(); 6插入功能实现: namespace 同学录 public partial class 添加 : Form public 添加() InitializeComponent(); private void 添加_Load(object sender, EventArgs e) private void textBox4_TextChanged(object sender, EventArgs e) private void label2_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) String str = Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True; SqlConnection conn = new SqlConnection(str); if (ConnectionState.Closed = conn.State) conn.Open(); SqlDataAdapter d = new SqlDataAdapter(); d.InsertCommand = new SqlCommand(INSERT INTO txxx(姓名,分组,手机,固定电话,家庭住址,QQ,其他资料)Values( + textBox1.Text + ,+textBox2.Text+, + textBox3.Text + , + textBox4.Text + , + textBox5.Text + , + textBox6.Text + , + textBox7.Text + ), conn); d.InsertCommand.ExecuteNonQuery(); conn.Close(); textBox1.Text = ; textBox2.Text = ; textBox3.Text = ; textBox4.Text = ; textBox5.Text = ; textBox6.Text = ; textBox7.Text = ; private void button2_Click(object sender, EventArgs e) Close(); 7.修改功能实现: namespace 同学录 public partial class 修改 : Form public 修改() InitializeComponent(); private void button1_Click(object sender, EventArgs e) String str = Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True; SqlConnection conn = new SqlConnection(str); if (ConnectionState.Closed = conn.State) conn.Open(); SqlDataAdapter d = new SqlDataAdapter(); String s = UPDATE txxx SET 姓名= + textBox1.Text + ,分组= + textBox2.Text + ,手机= + textBox3.Text + ,固定电话= + textBox4.Text + ,家庭住址= + textBox5.Text + ,QQ= + textBox6.Text + ,其他资料= + textBox7.Text + where 姓名=+textBox8.Text+; d.UpdateCommand = new SqlCommand(s, conn); d.UpdateCommand.ExecuteNonQuery(); conn.Close(); textBox1.Text = ; textBox2.Text = ; textBox3.Text = ; textBox4.Text = ; textBox5.Text = ; textBox6.Text = ; textBox7.Text = ; private void label8_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e) Close(); private void 修改_Load(object sender, EventArgs e) 8.输入密码功能实现:namespace 同学录 public partial class 删除1 : Form public 删除1() InitializeComponent(); private void 删除1_Load(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) int n = 0; String str = textBox1.Text.ToString().Trim(); SqlConnection conn = new SqlConnection(Data Source=.;Initial Catalog=tongxuelu;Integrated Security=True); String sql = select * from mima; if (ConnectionState.Closed = conn.State) conn.Open(); SqlCommand comm = new SqlCommand(sql, conn); SqlDataReader read = comm.ExecuteReader(); while (read.Read() if (read0.ToString().Trim() = str) 删除 f = new 删除(); f.Show(); Close(); n = 1; if (n = 0) MessageBox.Sh
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 壁画制作工技能操作考核试卷及答案
- 2025年滴灌管行业研究报告及未来行业发展趋势预测
- 细菌性疫苗生产工作业指导书
- 热力管网运行工数字化技能考核试卷及答案
- 钛白粉生产工理念考核试卷及答案
- 网络安全咨询员作业指导书
- 印染助剂生产工作业指导书
- 物流仓储管理与效率提升方案
- 能源消费侧智慧化管理平台创新创业项目商业计划书
- 幼儿园安全管理工作规范及考核表
- 保健公司客户服务流程规定
- 2025 整形外科面部痤疮瘢痕修复外科查房课件
- 赵子龙课件教学课件
- 肾脏先天畸形超声检查
- 软件工程概论第三版课件
- 心理健康与寝室生活
- 糖尿病病人饮食健康宣教
- 慢阻肺护理查房
- 2025北京顺义初三一模化学试卷
- 儿童健康开学第一课-守护成长,从健康开始
- 支付宝迎新活动策划方案
评论
0/150
提交评论