软件工程实验报告完整版

上传人:suij****uang 文档编号:204018924 上传时间:2023-04-25 格式:DOCX 页数:47 大小:452.98KB
收藏 版权申诉 举报 下载
软件工程实验报告完整版_第1页
第1页 / 共47页
软件工程实验报告完整版_第2页
第2页 / 共47页
软件工程实验报告完整版_第3页
第3页 / 共47页
资源描述:

《软件工程实验报告完整版》由会员分享,可在线阅读,更多相关《软件工程实验报告完整版(47页珍藏版)》请在装配图网上搜索。

1、XXXX大学软件工程课程实验报告(参考)题目:宿舍管理系统专业:计算机科学与技术班级:081班组: 第一组姓名:指导教师:完成日期:一、项目开发计划书3二、需求规格说明书.6三、设计规格说明书10四、源程序清单20五、测试报告36六、用户手册.41一、项目开发计划书完成人:1. 引言(Introduction)1.1 项目概述(Project Summary)该系统是由管理员通过系统管理学生信息,能根据学生学号、院系、 寝室号等来查询学生的其他相关信息,新生入住能录入新生的住宿信息, 能查询房间的信息如入住人数、人员等。学生遇毕业退学等原因迁出宿 舍,可以删除其住宿信息。1.2 术语定义(Te

2、rms Glossary)入住管理:要包括入住人员详细的学籍信息。房间信息:包括宿舍门号,电话号码以及可住人数,已住人数。信息查询:通过学生宿舍信息可以查询学生的详细信息。1.3 相关文档(Related Documents)1软件需求规格说明书设计规格说明书2. 软件生存周期(Software Life Cycle)本节记录项目策划生存期定义的工作结果,需要描述的主要内容:(1) 项目生存期框图(2)项目生存期说明需求分析3需求规格说明书(用例图,数据流图) 设计阶段3界面设计(界面规格说明)数据库设计 编码阶段3具体实现测试阶段3测试报告3. 任务与工作产品(Task and Work P

3、roducts)任务工作产品需求分析需求规格说明书、界面规格说明书系统设计系统设计说明书系统实现源程序测试测试报告产品交付用户手册4. 工作产品、任务规模、工作量估计(Estimates of Work Product,Task Size and Workload)任务规模估计需求分析整组同时参加讨论系统设计整组同时参加讨论系统实现两人负责一个大模块测试两人测试产品交付由一人写用户手册5.资源需求计划(Resource Requirement Plan)资源需求开发环境Microsoft Visual Studio 2005 SQL Server 2005 Windows 7测试环境SQL S

4、erver 2005 Windows 7,xp用户目标环境Windows 7,xp,2000计算机硬件资源CPU 2GHZ 内存2GB6.软件项目进度计划(Software Project Schedule)项目具体内容软件项目任务分解需求、系统设计、编码、测试设定的里程碑需求确定:11月1日界面设计、数据库设计完成:11月20日编码:11月2112月5号测试:12月10号一一12月16号开始和结束时间10月21日 12月16号缓冲时间15天人员分配需求分析:A 设计规格书:A 界面设计:A 编码:B 数据库:B 测试:B二、需求规格说明书完成人:1. 概述(Summary)1.1 项目的目的

5、与目标(Purpose and Aim of Project)为各集体宿舍管理人员提供,方便对宿舍楼进行管理,以便使用者能够更全面 的,更迅速的了解宿舍住宿情况的所有情况。软件可基于Windows98、2000、xp、Wingdows7系统上运行使用,具有操作简 单,功能清晰等特点。本软件根据宿舍的管理情况大致可分为四部分:首先是入住管理,提供登记入住信息、宿舍信息查询及迁出办理然后是房间管理模块,根据房间号修改、删除或添加信息其次是学生信息模块,查询学生信息,并根据学号更改学生宿舍。最后是房间信息模块,根据各种信息查询所需内容。1.2 术语定义(Terms Glossary)将该用户需求报告

6、中的术语、缩写进行定义,包括用户应用领域与计算机领域 的术语与缩写等。1.3 相关文档(Related Documents)1 项目开发计划书2 需求规格说明书3 涉及规格说明书4 产品使用说明书2. 问题初始分析(Early Analysis)2.1 场景描述(Scene Description)(1) 在宿舍要入住新成员时,宿舍管理者可使用本软件,添加入住人员信息(2) 在需要查询已住人员信息时,可以通过房间号等各种途径进行查询,对 宿舍已住情况一目了然(3) 在有人员迁出时,通过软件及时删除相关信息,使资源能够及时高效得到应用2.2 初始功能提取(Early Function Disti

7、ll)对于宿舍入住人员房间等信息进行清晰透明的管理3, 目标系统功能需求(Function of Target System)3.1功能需求点列表(Function List)在功能需求分析完成后,要详细列出用户需求功能点列表,提供给后续设计、 编程、测试中使用,更是为了用户测试验收中使用。功能需求点列表的格式,如表 2-1所示。表2-1功能需求点列表编 号功能名称使用人功能描述输入内容输出内容1添加入住信息宿舍管理 人员查找空房,添 加入住人员 信息入住房间、人 员信息信息更新2查询宿舍管理 人员根据关键词 查找入住信 息姓名、房间号或者其他关键词所匹配内容3删除信息宿舍管理 人员删除迁出数

8、 据房间号或者 迁出人员姓 名更新后的信 息.登迁出3.2 功能需求分析(Function Analysis)记 A ,住5. 目标系统界面与接口需求(Interface of Target System)5.1 界面需求(Interphase Requirement)(1) 输入设备:键盘、鼠标;(2) 输出设备:显示器;(3) 显示风格:图形界面,字符界面;(4) 显示方式:807*579;(5) 输出格式:显示布局。5.2 接口需求(Interface Requirement)6. 目标系统其他需求(Other Requirements of Target System)6.1 安全性(

9、Security)6.2 可靠性(Dependability)经过调试测试以确保系统的稳定性,从而确保系统的可靠性。6.3 灵活性(Agility)软件体积小,易于携带和安装。软件结构比较合理,方便以后的软件更新和维 护。架构相对灵活。当增加新的功能和部件时,能在较短时间完成相应的更新。6.4 特殊需求(Special Requirements)(1) 进度需求:系统的阶段进度要求在实验检查之前完成。(2) 运行环境需求:windows XP/windows7。7. 目标系统假设与约束条件(Suppose and Restriction of TargetSystem)(1) 本软件的所有权和

10、最终解释权归计算机科学与软件学院软件工程实验用 计算机081组所有。(2) 本软件需要在安装了SQL SERVER2005的windows 7/windows XP环境下 运行。(3) 可利用的信息和资源:数据库sql2005。(4) 系统投入使用的最晚日期:2011年12月。三、设计规格说明书完成人:1. 引言(Introduction)本章对该文档的目的、功能范围、术语、相关文档、参考资料、版本更新进行 说明。1.1 目的(Purpose)随着越来越多的人进入大学学习,宿舍管理是一项越来越重要的工作。早期的手动管理方式,存在着难以备份,数据遗漏,冲突,核查不准确等缺陷。因此,开发一个 既可

11、以存储信息,又可以进行更新,查询等功能的宿舍管理系统显得尤为重要。1.2项目背景软件开发平台:Microsoft Visual Studio 2005Microsoft SQL Server 2005本项目的提出是按照学校实验程序的要求,经过小组成员的讨论,结合学习实 践而最终决定的,该项目结合了数据库技术,软件工程技术及c#的编程。该软件 运行于 windows 平台。1.3 参考资料(References)1 用户需求报告2 数据库设计规范3 命名规范1.4 相关文档(Related Documents)1 源程序清单2 测试计划及报告3 用户使用手册2. 总体设计(Design of C

12、ollective)2.1 体系结构设计(Design of Architecture)2.2 子系统清单(Subsystem List)子系统清单,如表3-2所示。子系统编号子系统英文名子系统功能简述子系统之间的关系SS1入住管理房间设置中的宿舍信 息决定入住管理中的 有关宿舍信息,学生信 息登记到学生管理SS2房间设置房间设置中的宿舍信 息决定入住管理、房间 查询、学生管理中的有 关宿舍信息SS3房间查询房间设置中的宿舍信 息决定房间查询中的 有关宿舍信息SS4学生管理房间设置中的宿舍信 息决定学生管理中的 有关宿舍信息,其登入 和迁出由入住管理实 现2.3功能模块清单(Module Li

13、st)模块(功能函数或类)清单,如表3-3所示。表3-3模块清单模块编号模块英文名模块功能简述模块的接口简述M 1-1Button4 _Click登记入住输入:学生信息 输出:无M 1-2Button5_Click迁出输入:学号输出:宿舍可住人数增加,巳住人数减少M 1-3Button2_Click查询空房输入:无输出:可住入房间M 1-4Button3_Click查询满房输入:无输出:已住满房间M 2-1添加_Click房间添加输入:房间信息 输出:房间信息M 2-2Button6_Click房间删除输入:宿舍号 输出:删除房间信 息M 2-3修改_C lick房间修改输入:宿舍号输出:房间

14、信息M 2-4Button6 Click房间浏览输入:无输出:所有房间信 息M 2-5Button11_Click房间查询输入:选择信息 输出:房间信息M 2-6Button9_Click学生查询输入:学生信息 输出:学生信息M 2-7Button8_Click学生浏览输入:无输出:所有学生信 息M 2-8Button12_Click更换宿舍输入:学号、宿舍 号、新宿舍号 输出:学生信息3. 数据结构设计(Design of Data Structure )3.1数据库表名清单(DB Table List)数据库表名清单,如表3-4所示。表3-4数据库表名清单序 号中文表名英文表名表功能说明1

15、学生信息 表student存储学生基本信息2宿舍信息 表room存储房间信息表3.3 数据库表的详细清单(Particular List of DB Table)每个表的详细清单内容包括:表名、字段中文名、字段英文名、字段的类型、 宽度、精度、主键/外键、空否、取值约束(默认值、最大值、最小值)、索引否。 同时要指出该表的索引:索引文件名、索引字段名、索引特性(主键索引、惟一索 引unique、聚集索引clustered)。详细清单可以用列表给出,如表3-5所示。表3-5 表名:room序号字段中文 名字段英文 名类型、宽度、精 度取值约 束空 否默认值主键/外 键索引否1宿舍号Int否2电话

16、号码varchar(50)否3可住人数varchar(10)否4网线端口varchar(50)否表名:student序号字段中文 名字段英文 名类型取值约束空否主键1姓名varchar(10)否2性别varchar(10)否3学号Int否4学院varchar(20)否5班级varchar(10)否6电话号码Int否7宿舍号Int否3.4主窗体详细设计3.4.1入住管理详细设计功能:登记学生入住,迁出学生,查询宿舍输入:学生信息、宿舍号输出:宿舍信息界面:重要部分伪代码描述:“登记入住”按钮If输入信息无效向用户提供错误提示Else将信息添加到数据库“迁出”按钮If输入信息无效向用户提供错误提示

17、Else将信息从数据库删除“查询”、“查询空房”、“查询满房”按钮If输入信息无效向用户提供错误提示Else将信息显示到表中3.4.2房间设置详细设计功能:添加,修改,删除,浏览房间信息输入:房间信息输出:房间信息重要部分伪代码描述:“添加”按钮If输入信息无效向用户提供错误提示Else将信息添加到数据库“删除”按钮选中行,将信息从数据库删除“修改”按钮If输入信息无效向用户提供错误提示Else将信息更新到数据库“所有房间列表”按钮列出所有房间信息到表中3.4.3房间查询详细设计功能:根据不同条件查询房间信息输入:房间信息输出:房间信息重要部分伪代码描述:“选择”按钮选择*方式表中按*方式列出

18、需要房间信息3.4.4学生管理详细设计功能:根据不同条件查询学生信息,更换学生宿舍输入:学生信息输出:学生信息重要部分伪代码描述:“查询”按钮If输入信息无效向用户提供错误提示Else将信息显示到表中“整体查询”按钮列出所有学生信息到表中“修改”按钮If输入信息无效向用户提供错误提示Else将信息更新到数据库3.4.4关于我们功能:制作者小组简介3.5 其他数据结构设计(Design of Other Data Structure)此小节描述系统的其他数据结构设计内容。4. 接口设计(Interface Design)对应每一个接口,都要详细列出下列内容。(1) 接口名称(2) 接口内容(3)

19、 接口设施(4) 接口的数据结构(5) 接口的传输速率(Mbps)(6) 接口带宽(7) 接口协议源程序清单1 # (Module Name)1.1 描述(Description)模块编号模块英文名模块功能简述模块的接口简述M 1-1Button4 _Click登记入住输入:学生信息 输出:无M 1-2Button5_Click迁出输入:学号输出:宿舍可住人数增加,巳住人数减少M 1-3Button2_Click查询空房输入:无输出:可住入房间M 1-4Button3_Click查询满房输入:无输出:已住满房间M 2-1添加_Click房间添加输入:房间信息 输出:房间信息M 2-2Butto

20、n6_Click房间删除输入:宿舍号 输出:删除房间信 息M 2-3修改_ Click房间修改输入:宿舍号 输出:房间信息M 2-4Button6_Click房间浏览输入:无输出:所有房间信 息M 2-5Button11_Click房间查询输入:选择信息 输出:房间信息M 2-6Button9_Click学生查询输入:学生信息 输出:学生信息M 2-7Button8_Click学生浏览输入:无输出:所有学生信 息M 2-8Button12_Click更换宿舍输入:学号、宿舍 号、新宿舍号 输出:学生信息1.2 代码(Program)using System;using System.Colle

21、ctions.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Data.SqlClient;using System.Text;using System.Windows.Forms;namespace softpublic partial class Form1 : Formpublic Form1()InitializeComponent();private void Form1_Load(object sender, EventArgs e)/ TODO:这行代码

22、将数据加载到表“susheDataSet3.student”中。您可以根据需要 移动或移除它。this.studentTableAdapter1.Fill(this.susheDataSet3.student);/ TODO:这行代码将数据加载到表“susheDataSet2.room”中。您可以根据需要移 动或移除它。this.roomTableAdapter1.Fill(this.susheDataSet2.room);/ TODO:这行代码将数据加载到表“susheDataSet1.student”中。您可以根据需要 移动或移除它。this.studentTableAdapter.Fil

23、l(this.susheDataSet1.student);/ TODO:这行代码将数据加载到表“susheDataSet.room”中。您可以根据需要移动 或移除它。dataGridView3.DataSource = null;dataGridView5.DataSource = null;/根据宿舍号查询房间信息private void button1_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection();con.ConnectionString = Data Source=XUN-PCXUN;

24、Initial Catalog=sushe;Integrated Security=True;con.Open();SqlCommand com1 = new SqlCommand(select * from student where 宿舍号=+ textBox1.Text + , con);if (null != com1.ExecuteScalar()string str = select * from room where 宿舍号=+ textBox1.Text + ;SqlDataAdapter ada = new SqlDataAdapter(str, con);DataSet d

25、s = new DataSet();ada.Fill(ds, room);dataGridView1.DataSource = ds.Tablesroom”;con.Close();elseMessageBox.Show(无此宿舍号!”);private void fillByToolStripButton_Click(object sender, EventArgs e)trythis.roomTableAdapter.FillBy(this.susheDataSet.room);catch (System.Exception ex)System.Windows.Forms.MessageB

26、ox.Show(ex.Message);查询空房private void button2_Click(object sender, EventArgs e)SqlConnection con = new SqlConnection();con.ConnectionString = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;con.Open();string str = select * from room where 巳住人数6;SqlDataAdapter ada = new SqlDataAda

27、pter(str, con);DataSet ds = new DataSet();ada.Fill(ds, room);dataGridView1.DataSource = ds.Tablesroom;con.Close();查询满房private void button3_Click(object sender, EventArgs e)SqlConnection con = new SqlConnection();con.ConnectionString = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=T

28、rue;con.Open();string str = select * from room where 巳住人数=6;SqlDataAdapter ada = new SqlDataAdapter(str, con);DataSet ds = new DataSet();ada.Fill(ds, room);dataGridView1.DataSource = ds.Tablesroom;con.Close();迁出学生private void button5_Click(object sender, EventArgs e)if (textBox8.Text != & textBox7.T

29、ext !=) DialogResult result = MessageBox.Show(确定迁 出此学生吗?,”提示”, MessageBoxButtons.OKCancel);switch (result)case DialogResult.OK:SqlConnection con = new SqlConnection();con.ConnectionString = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;con.Open();SqlCommand coml = new SqlComma

30、nd(select * from student where 学号=+ textBox8.Text + , con);if (null != com1.ExecuteScalar()SqlCommand com = new SqlCommand(delete from student where 学号=+ textBox8.Text + , con);com.ExecuteNonQuery();SqlDataAdapter ada = new SqlDataAdapter(select * from student, con);DataSet ds = new DataSet();ada.Fi

31、ll(ds, student);dataGridView3.DataSource = ds.Tablesstudent;SqlDataAdapter adal = new SqlDataAdapter(select * from room, con);DataSet ds1 = new DataSet();ada1.Fill(ds1, room);dataGridViewl.DataSource = ds1.Tablesroom;string str = update room set 可住人数=可住人数+1,巳住人数=已 住人数-1 where 宿舍号=+ textBox7.Text + ;

32、SqlCommand com2 = new SqlCommand(str, con);com2.ExecuteNonQuery();con.Close();ds.Clear();MessageBox.Show(”迁出学生成功!”); elseMessageBox.Show(宿舍+ textBox7.Text + 不存在学号为+ textBox8.Text + 的学生!”);break ;case DialogResult.Cancel:若干代码 break;elseMessageBox.Show(请输入完整信息!”); private void groupBox5_Enter(object s

33、ender, EventArgs e) 登记入住private void button4_Click(object sender, EventArgs e) if (textBox2.Text != & textBox3.Text != & textBox4.Text != & textBox5.Text !=& textBox6.Text != & comboBox1.Text != & comboBox2.Text != & comboBox3.Text !=)SqlConnection con = new SqlConnection();con.ConnectionString = Da

34、ta Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True”;con.Open();SqlDataAdapter da = new SqlDataAdapter(select * from room where 宿舍号=+ textBox6.Text + , con);DataSet ds = new DataSet();da.Fill(ds, room);SqlCommand cmd1 = new SqlCommand(select * from student where 学号=+ textBox3.Text + ,

35、 con);SqlCommand cmd2 = new SqlCommand(select 入住性另U from room where 宿舍 号=+ textBox6.Text + , con);if (null = cmd1.ExecuteScalar() if (Convert.ToInt16(ds.Tablesroom.Rows0巳住人数”) 6)string str4 = select 入住性别 from room where 宿舍号=+ textBox6.Text + ;string str = insert into student(姓名,性别,宿舍号,学号,电话,学院,年级, 班

36、级)values( + textBox2.Text + , + comboBox1.Text + , + textBox6.Text + , + textBox3.Text + , + textBox5.Text + , + comboBox3.Text + , + comboBox4.Text + , + textBox4.Text + );SqlCommand com = new SqlCommand(str, con);com.ExecuteNonQuery();string str1 = update room set 可住人数=可住人数-1,巳住人数=巳住人 数+1 where 宿舍

37、号= + textBox6.Text + ;SqlCommand com1 = new SqlCommand(str1, con);com1.ExecuteNonQuery();SqlDataAdapter ada1 = new SqlDataAdapter(select * from room, con);DataSet ds1 = new DataSet();ada1.Fill(ds1, room);con.Close();MessageBox.Show(登记入住成功!”);dataGridView1.DataSource = ds1.Tablesroom”;else MessageBox

38、.Show(此宿舍巳住满!登记失败!”);else MessageBox.Show(巳有此学生,无需登记!);else MessageBox.Show(请输入完整信息);所有房间列表private void button6_Click(object sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();string select = s

39、elect * from room;SqlDataAdapter adapter = new SqlDataAdapter(select, con);DataTable table = new DataTable();adapter.Fill(table);this.dataGridView2.DataSource = table.DefaultView;con.Close();private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) 删除当前房间private void bu

40、tton7_Click(object sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();int i;i = this.dataGridView2.CurrentRow.Index;DialogResult result = MessageBox.Show(确定要删除此房间信息吗?,提示, MessageBoxButtons.OKCa

41、ncel);switch (result)case DialogResult.OK:string sql = delete from room where 宿舍号=+ this.dataGridView20, i.Value.ToString() + ;SqlCommand cmd = new SqlCommand(sql, con);cmd.CommandText = sql;cmd.ExecuteNonQuery();MessageBox.Show(删除+ this.dataGridView20, i.Value.ToString() + 成功”,”提 示);SqlDataAdapter

42、adp = new SqlDataAdapter(SELECT * FROM room, con);DataSet ds = new DataSet();adp.Fill(ds, room);DataTable dt = ds.Tablesroom”;dataGridView2.DataSource = dt;con.Close();/若 干代码break;case DialogResult.Cancel:con.Close();/若 干代码break;学生信息整体查询private void button8_Click(object sender, EventArgs e)string co

43、nn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();string strsql = select * from student ;SqlDataAdapter da = new SqlDataAdapter(strsql, con);DataSet ds = new DataSet();da.Fill(ds, student);this.dataGridView3.DataSource =

44、ds.Tablesstudent;con.Close();private void button9_Click(object sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();if (textBox12.Text.Trim() =& comboBox5.Text.Trim() =&textBox14.Text.Trim()=)Mes

45、sageBox.Show(请输入查询条件!”);con.Close();elsestring str = Select * from student where 姓名=+ textBox12.Text.Trim() + or 性别=+ comboBox5.Text + or 宿舍号=+ textBox14.Text + ;SqlDataAdapter da = new SqlDataAdapter(str, con);DataSet ds = new DataSet();ds.Clear();da.Fill(ds, student);this.dataGridView3.DataSource

46、= ds.Tablesstudent;con.Close();private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e) 学生信息修改private void button10_Click(object sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection

47、(conn);con.Open();string s2 =;switch (listBox2.SelectedIndex)case 0:con.Close();return;case 1:s2 = select * from room order by 宿舍号 ;break;case 2:con.Close();return;case 3:s2 = select * from room order by 可住人数”;break;case 4:con.Close();return;case 5:s2 = select * from room order by 网线端口 ”;break;case

48、6:con.Close();return;case 7:s2 = select * from room order by 电话号码 ;break;SqlDataAdapter da1 = new SqlDataAdapter(s2, con);DataSet d = new DataSet();d.Clear();da1.Fill(d, room);this.dataGridView5.DataSource = d.Tablesroom;con.Close();添加房间信息private void 添加_Click(object sender, EventArgs e)string conn

49、= Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();if (textBox9.Text.Trim() = | textBox11.Text.Trim() = | comboBox4.Text.Trim() = )MessageBox.Show(请输入完整的添加信息”,”提示”);con.Close();elseSqlCommand cmd = new SqlCommand(select * fro

50、m room where 宿舍号=+ textBox9.Text.Trim() + , con);if (null != cmd.ExecuteScalar()MessageBox.Show(巳有此宿舍!,”提示”); con.Close();elsestring sqll, sql2, sql3;sqll = insert into room(宿舍号,可住人数,入住性别,电话号码,巳住人数”;sql2 = values( + textBox9.Text.ToString() + , + textBox11.Text.ToString() + , + comboBox4.Text.ToStri

51、ng() + , + textBox10.Text.ToString() + ,0;sql3 = sql1 + ) + sql2 + );cmd.CommandText = sql3;cmd.ExecuteNonQuery();textBox9.Clear();textBox10.Clear();textBox11.Clear();MessageBox.Show(信息添加成功”,”提示”);SqlDataAdapter adp = new SqlDataAdapter(select * from room, con);DataSet ds = new DataSet();adp.Fill(ds

52、, room);dataGridView2.DataSource = ds.Tablesroom”;con.Close();修改房间信息private void 修改_Click(object sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();if (textBox9.Text.Trim() = | textBox11.Text.T

53、rim() = | comboBox4.Text.Trim() = )MessageBox.Show(请输入完整信息!,提示);con.Close();elseSqlCommand cmd = new SqlCommand(select * from Table_1 where 宿舍号=+ textBox9.Text.Trim() + , con);if (null != cmd.ExecuteScalar()string sql2;sql2 = UPDATE Table_1 SET 宿舍号=+ textBox9.Text.Trim() + ,可 住人数=+ textBox11.Text.Tr

54、im() + ,入住性别=+ comboBox4.Text.Trim() + ,电话号码=+ textBox10.Text.Trim() + WHERE 宿舍号=+ textBox9.Text.Trim() + ;SqlCommand cmd1 = new SqlCommand(sql2, con);cmd1.ExecuteNonQuery();MessageBox.Show(修改成功!,”提示”);con.Close();elseMessageBox.Show(无此宿舍!请重新输入!,”提示”);con.Close();修改学生信息private void button11_Click(ob

55、ject sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;Integrated Security=True;SqlConnection con = new SqlConnection(conn);con.Open();string s2 =;switch (listBox2.SelectedIndex)case 0:con.Close();return;case 1:s2 = select * from room order by 宿舍号 ”;break;case 2:con.Close

56、();return;case 3:s2 = select * from room order by 可住人数”;break;case 4:con.Close();return;case 5:s2 = select * from room order by 网线端口 ”;break;case 6:con.Close();return;case 7:s2 = select * from room order by 电话号码 ;break;SqlDataAdapter da1 = new SqlDataAdapter(s2, con);DataSet d = new DataSet();d.Clea

57、r();da1.Fill(d, room);this.dataGridView5.DataSource = d.Tablesroom;con.Close();修改学生信息private void button10_Click_1(object sender, EventArgs e)string conn = Data Source=XUN-PCXUN;Initial Catalog=sushe;IntegratedSecurity=True”;SqlConnection con = new SqlConnection(conn);con.Open();if (textBox13.Text.Trim() = & textBox15.Text.Trim() = & textBox16.Text.Trim()=)MessageBox.Show(请输入完整信息!,提示);con.Close();elseSqlCommand cmd = new SqlCommand(select * f

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!