中北大学课程设计说明书数据库大型实验周学生姓名:苗瑞林学号:0906034216 学生姓名: 罗凡钰学号:0906034250 学生姓名: 曹旭利学号:0906034204 学生姓名: 黄丽学号:0906034208 学院:专业:题目: 英语学习助手指导教师:职称:2012 年 6月 22日1.设计目的随着社会的发展和时代的进步,英语已经成为人们在日常生活和工作中必须掌握和应用语言。
为了更好、更快的掌握英语基础知识,尽快具备英语会话和写作能力,适应当前人们的工作、生活需要,推动英语学习的普及,所以我们小组集体开发了这套完整的英语学习助手,欢迎大家使用和提出改进意见。
此系统主要实现了以下几大功能:后台:单词及单词例句信息管理(英语单词的录入、修改、删除);前台:实现英语单词检索、翻译。
英语单词自测,自测结果显示功能。
2.设计内容(1)主要的数据表用户表,英语分级单词表,常用单词例句表等等。
(2)主要功能模块1)实现英语单词的录入、修改、删除等基本操作。
2)实现常用英语单词例句的录入、修改、删除等基本操作。
3)实现英语单词检索、翻译等。
4)常用英语单词例句检索。
5)随机生成一份单词测试题目。
3.开发和运行环境介绍开发工具:Visual Studio 2010,SQL2008运行环境:Windows 9x 、Windows NT、Windows 2000、 Windowsxp 操作系统。
4.需求分析4.1功能需求本系统的功能分为如下几大模块:1.单词模块:包括单词表的建立,单词的录入、修改、删除等基本操作。
单词表包括单词和汉语翻译以及初级、中级、高级三种难度单词的分类。
单词录入要求能够实现录入(增加)单词及其汉语翻译;修改要求能修改单词的拼写以及其汉语意思;删除即能够删除某一单词记录。
2.例句模块:包括例句表的建立,例句的录入、修改、删除等基本操作。
例句表包括例句及其中文翻译等。
例句录入要求能够实现录入(增加)例句及其汉语翻译;修改要求能修改例句的单词以及其汉语意思;删除即能够删除某一例句记录。
3.试题模块:随机生成一份相应难度的单词测试表。
可以给出英文单词选择其正确的汉语翻译4.检索模块:包括单词检索和例句检索,。
单词检索要实现输入一个单词,可以检索出它的汉语翻译。
例句检索要能实现输入句子,可以检索出其中文翻译。
4.2 性能需求(1)尽量采取学校现有软硬件环境,及先进的管理系统开发方案,从而达到充分利用学校现有资源,提高系统系统开发水平的目的。
(2)系统应符合学校学生现有的多媒体条件,满足学生日常英语学习的需要,并达到操作过程的直观,方便,实用等要求。
(3)系统采用模块化程序设计方法,既便于系统功能的各种组合和修改。
4.3 数据流图(1)顺序图符合,登录成功不符合,登录失败(2)E-R图图2 E-R图5.系统设计与实现(写清楚每个人负责的模块)5.1 模块功能描述苗瑞林:自测,实现单词和例句的修改罗凡钰:实现单词和例句的检索曹旭利:实现例句的录入,删除黄丽:实现单词的录入,删除5.2 软件实现黄丽:实现单词的录入,删除添加单词:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){}private void btnYes_Click(object sender, EventArgs e){string word = textBox1.Text;string fanyi=textBox2.Text;string dengji=textBox3.Text;string Num = textBox4.Text;string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);string sql = String.Format("INSERT INTO word(Num,word,fanyi,dengji)VALUES('{0}','{1}','{2}','{3}')",Num,word,fanyi,dengji);con.Open();SqlCommand cmd = new SqlCommand(sql, con);int count = cmd.ExecuteNonQuery();if (count>0){MessageBox.Show("添加英语单词成功!","添加成功",MessageBoxButtons.OK,rmation);}else{MessageBox.Show("添加失败!","添加失败",MessageBoxButtons.OK,rmation); }}private void lblWord_Click(object sender, EventArgs e){}private void btnClose_Click(object sender, EventArgs e) {Form3 ss = new Form3();ss.Show();this.Visible = false;}}}删除单词:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1{public partial class Form4 : Form{public Form4(){InitializeComponent();}private void Form4_Load(object sender, EventArgs e){string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123"; SqlConnection con = new SqlConnection(Constr);string sql = "select * from word";con.Open();SqlDataAdapter adpt=new SqlDataAdapter(sql, con);DataTable dt=new DataTable();adpt.Fill(dt);dataGridView1.DataSource = dt;}private void button1_Click(object sender, EventArgs e){string id = dataGridView1.Rows[0].Cells[0].Value.ToString();string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);string sql = "DELETE from word WHERE Num="+id+"";string sql1 = "SELECT * FROM word";con.Open();SqlCommand cmd = new SqlCommand(sql, con);if (cmd.ExecuteNonQuery() > 0){string message = String.Format("删除成功", cmd.ExecuteNonQuery());MessageBox.Show(message, "删除成功", MessageBoxButtons.OK, rmation);SqlDataAdapter adpt = new SqlDataAdapter(sql1,con);DataTable dt = new DataTable();adpt.Fill(dt);dataGridView1.DataSource = dt;}}private void button2_Click(object sender, EventArgs e){Form3 ssi = new Form3();ssi.Show();this.Visible = false;}private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e){}}}曹旭利:实现例句的录入,删除添加例句:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1{public partial class Form7 : Form{public Form7(){InitializeComponent();}private void Form7_Load(object sender, EventArgs e){}private void btnYes_Click(object sender, EventArgs e){string sentence = textBox1.Text;string fanyi = textBox2.Text;string sword = textBox3.Text;string Num = textBox4.Text;string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);string sql = String.Format("INSERT INTO sentence(Num,sentence,fanyi,sword) VALUES('{0}','{1}','{2}','{3}')", Num, sentence, fanyi, sword);con.Open();SqlCommand cmd = new SqlCommand(sql, con);SqlCommand command = new SqlCommand(sql, con);if (cmd.ExecuteNonQuery() > 0){MessageBox.Show("添加英语例句成功!", "添加成功",MessageBoxButtons.OK, rmation);}else{MessageBox.Show("添加失败!", "添加失败",MessageBoxButtons.OK, rmation);}}private void lblSword_Click(object sender, EventArgs e) {}private void button2_Click(object sender, EventArgs e) {Form3 ss = new Form3();ss.Show();this.Visible = false;}}}删除例句:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1{public partial class Form9 : Form{public Form9(){InitializeComponent();string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123"; SqlConnection con = new SqlConnection(Constr);string sql = "select * from sentence";con.Open();SqlDataAdapter adpt = new SqlDataAdapter(sql, con);DataTable dt = new DataTable();adpt.Fill(dt);dataGridView1.DataSource = dt;}private void button3_Click(object sender, EventArgs e){string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123"; SqlConnection con = new SqlConnection(Constr);string sql = "select * from sentence";con.Open();SqlCommand cmd = new SqlCommand(sql, con);cmd.ExecuteNonQuery();}private void textBox1_TextChanged(object sender, EventArgs e){}private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e){}private void button2_Click_1(object sender, EventArgs e){Form3 ssi = new Form3();ssi.Show();this.Visible = false;}private void button1_Click_1(object sender, EventArgs e){string id = dataGridView1.Rows[0].Cells[0].Value.ToString();string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);string sql = "DELETE from sentence WHERE Num=" + id + "";string sql1 = "SELECT * FROM sentence";con.Open();SqlCommand cmd = new SqlCommand(sql, con);if (cmd.ExecuteNonQuery() > 0){string message = String.Format("删除成功", cmd.ExecuteNonQuery());MessageBox.Show(message, "删除成功", MessageBoxButtons.OK, rmation);SqlDataAdapter adpt = new SqlDataAdapter(sql1, con); DataTable dt = new DataTable();adpt.Fill(dt);dataGridView1.DataSource = dt;}}private void Form9_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.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1{public partial class Form2 : Form{public Form2(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);con.Open();string word = textBox1.Text;string sql = String.Format("select fanyi from word where word='{0}'", word);SqlCommand cmd = new SqlCommand(sql, con);string wordone = Convert.ToString(cmd.ExecuteScalar());textBox2.Text =wordone;bool row = cmd.ExecuteScalar()!=null;if (row){string message = String.Format("查询成功", cmd.ExecuteNonQuery());MessageBox.Show(message, "查询成功", MessageBoxButtons.OK, rmation);}else{MessageBox.Show("查询失败!", "查询失败",MessageBoxButtons.OK, rmation);}}private void button2_Click(object sender, EventArgs e) {Form3 asd = new Form3();asd.Show();this.Visible = false;}private void Form2_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 WindowsFormsApplication1{public partial class Form11 : Form{public Form11(){InitializeComponent();private void button1_Click(object sender, EventArgs e){string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);con.Open();string word = textBox1.Text;string sql = String.Format("select fanyi from sentence where sentence='{0}'", word);SqlCommand cmd = new SqlCommand(sql, con);string wordone = Convert.ToString(cmd.ExecuteScalar());textBox2.Text = wordone;bool row = cmd.ExecuteScalar() != null;if (row){string message = String.Format("查询成功", cmd.ExecuteNonQuery());MessageBox.Show(message, "查询成功", MessageBoxButtons.OK, rmation);}else{MessageBox.Show("查询失败!", "查询失败",MessageBoxButtons.OK,rmation);}}private void button2_Click(object sender, EventArgs e){Form3 asd = new Form3();asd.Show();this.Visible = false;}}}苗瑞林:自测,实现单词和例句的修改单词修改: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 WindowsFormsApplication1{public partial class Form5 : Form{public Form5(){InitializeComponent();string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";string sql = "select * from word";SqlConnection con = new SqlConnection(Constr);con.Open();SqlDataAdapter adpt = new SqlDataAdapter(sql, con);DataTable dt = new DataTable();adpt.Fill(dt);dataGridView1.DataSource = dt;}private void Form5_Load(object sender, EventArgs e){}private void button2_Click(object sender, EventArgs e){string num = textBox1.Text;string num1 = textBox2.Text;string num2 = textBox3.Text;string num3 = textBox4.Text;string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);string sql = "Update word set word='"+num1+"',fanyi='"+num2+"', dengji='"+num3+"' where Num='"+num+"'";con.Open();try{SqlCommand cmd = new SqlCommand(sql, con);int count = cmd.ExecuteNonQuery();if (count>0){MessageBox.Show("修改英语单词成功!","修改成功",MessageBoxButtons.OK,rmation);}else{MessageBox.Show("修改失败!","修改失败",MessageBoxButtons.OK,rmation);}}catch (Exception ex){MessageBox.Show(ex.Message,"操作数据库出错!",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);}finally{con.Close();}}private void button1_Click(object sender, EventArgs e)Form3 sw = new Form3();sw.Show();this.Visible = false;}private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e){}}}例句修改:using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1{public partial class Form10 : Form{public Form10(){InitializeComponent();}private void button1_Click(object sender, EventArgs e)string num = textBox1.Text;string num1 = textBox2.Text;string num2 = textBox3.Text;string num3 = textBox4.Text;string Constr = "server = .;database=ENGLISHWORD;uid=sa;pwd=123";SqlConnection con = new SqlConnection(Constr);string sql = "update sentence set sentence='"+num1+"',sword='"+num2+"',fanyi='"+num3+"' where Num='"+num+"'";con.Open();try{SqlCommand cmd = new SqlCommand(sql, con);int count = cmd.ExecuteNonQuery();if (count > 0){MessageBox.Show("修改英语单词成功!", "修改成功",MessageBoxButtons.OK,rmation);}else{MessageBox.Show("修改失败!", "修改失败",MessageBoxButtons.OK,rmation);}}catch (Exception ex){MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK,MessageBoxIcon.Exclamation);}finally{con.Close();}}private void button2_Click(object sender, EventArgs e) {Form3 sap = new Form3();sap.Show();this.Visible = false;}}}6.软件测试6.1测试方法(1)动态黑盒测试,即不深入代码细节的软件测试方法,对软件的各功能模块进行通过性测试。