热门搜索 :
考研考公
您的当前位置:首页正文

数据库点菜系统实训报告

来源:伴沃教育


江 西 科 技 师 范 学 院

数据库系统设计实训报告

学院:数学与计算机学院 班级:信息管理 学号:20142432 姓名:林紫

数据库系统设计实训报告

实验一 点菜系统数据库设计需求分析

一、 实验目的

掌握数据库设计中需求分析的方法。

二、 实验原理

数据库设计中进行需求分析的方法。

三、 主要仪器及耗材

计算机、SQL SERVER 2000。

四、 实验内容与步骤

1. 点菜系统数据库的需求分析(文字描述)。

餐饮点菜系统拥有方便、快捷、效率高、掌控能力强等特点,它改变了传统的点菜管理观念,充分体现了信息化餐饮管理系统给企业的快速发展带来的好处。所以,本系统是针对餐饮行业的点菜而开发的一个系统。开发本系统的总体任务是实现点菜、结帐、查询、统计、设置的功能,点菜时可用菜名的拼音简码搜索菜,查询菜和点菜单,统计一天的营业额,实现酒店餐饮点菜的系统化和自动化。

本系统的总目标是为用户提供迅速、高效的服务,减免手工处理的繁琐与误差,及时、准确地反映酒店的工作情况、经营情况,从而提高酒店的服务质量,获得更好的经济效益。其具体目标包括:

(1)快速完成顾客的点餐。

(2)准确无误地记录顾客的每笔消费记录。 (3)实时、快速、准确地提供最新餐单。 (4)方便查询顾客消费情况。 (5)方便查询酒店的营业额情况。

2.功能划分

1、服务员信息的管理:查询、增加、删除、修改 2、菜单信息的管理:查询、增加、删除、修改 3、厨师信息的管理:查询、增加、删除、修改 4、房间信息的管理:查询、增加、删除、修改 5、餐桌信息的管理:查询、增加、删除、修改

6、前台定桌:顾客可以根据自己的需求,选择不同型号的房间或大厅,也

可以提前预订。

7、房间、大厅点菜:服务台按照用户需求为其点菜并提交菜单给厨房 8、厨房和菜的分组:厨师和菜分别分组,每组厨师和一组菜一一对应,该

组每位选择不同型号的房间或大厅,也可以提前预定。

9、厨师做管理:厨师可以获得自己的待做菜单,对已做的菜进行标记。 10、上菜管理:服务员对已上菜和待上菜进行管理。 11、结帐服务:审核菜单,协助顾客结帐。

2

数据库系统设计实训报告

3数据描述

1. 员工的基本信息:员工编号、姓名、联系方式、职位 2. 房间的基本信息:房间编号、房间桌子数 3. 桌子的基本信息:桌子编号、状态、人数 4. 菜肴表的基本信息:菜价、口味、菜品、图片

5. 菜单生成信息:菜单编号、菜、数量、桌子编号、总价、顾客信息、

打折程度、实价

6. 厨师基本信息:厨师编号、擅长

7. VIP顾客信息:姓氏、年龄、联系方式、等级 8. 系统管理和的相关信息:管理员编号、名密码 3

数据库系统设计实训报告

实验二 点菜系统数据库概要设计

一、 实验目的

掌握数据库设计中概要设计的方法。

二、 实验原理

数据库设计的概要设计的方法。

三、 主要仪器及耗材

计算机、SQL SERVER 2000。

四、 实验内容与步骤

1.点菜系统数据库的概要设计(E-R)。

1、员工表: 员工ID,姓名,性别,出生日期,联系电话,员工类别,薪水,从业日期,,管理员ID。

2管理员表:管理员ID,姓名,性别,密码,联系电话。

3、顾客表,:顾客ID,顾客姓名,会员类别,性别,生日,电话,喜好,单位,,地址,折扣,累计消费金额

4、厨师表:厨师ID,姓名,性别,电话,擅长菜系。

5、房间表:房间ID,房间名,房间容量,房间类别,是否预定,位置,

6、桌子表:桌子ID,名称,座位数量,桌台状态,备注说明,房间号,员工ID 7、菜肴表: 菜肴ID,名称,详细说明,类别,主要原材料,照片,单价,折扣,有效标志,建立日期,推荐程度,口味,

8帐单表:账单ID、账单桌号、日期和时间、菜单总额、实收总额,顾客类别,负责员工

9:员工管理桌子:员工ID,桌子ID,时间

10 点菜:桌子ID,菜肴ID,时段,数量,金额,是否已上菜 11、厨师做菜表:厨师ID,桌子ID,菜肴ID,时间

4

数据库系统设计实训报告

员工姓名 性别 员工 联系方式 n 管理 管理员 房间编号 房间 房间类别 n 顾客编号 顾客 姓名 时段 金额 n 点菜 菜名 m 菜肴 m 菜系 价格 菜肴编号 状态 做菜 n 性别 厨师 所做菜系 数量 上菜 n 厨师编号 桌子 桌子状态 m 管理 m 属于 m 桌子编号 口味 顾客编号 顾客 姓名 1 结账 m 账单 账单编号 负责员工 账单桌号 顾客类别 日期时间 菜单总额 实收金额

5

数据库系统设计实训报告

实验三 点菜系统数据库物理设计与实现

一、 实验目的

掌握数据库设计中物理设计与实现的方法。 二、

实验原据库设计的物理设计与实现的方法。

三、 主要仪器及耗材

计算机、SQL SERVER 2000。

四、 实验内容与步骤

1. 点菜系统数据库的物理设计与实现的方法。

1、员工表: 员工ID,姓名,性别,出生日期,联系电话,员工类别,薪水,从业日期, 管理员ID。

2管理员表:管理员ID,姓名,性别,密码,联系电话。

3、顾客表,:顾客ID,顾客姓名,会员类别,性别,生日,电话,喜好,单位,,地址 4、厨师表:厨师ID,姓名,性别,电话,擅长菜系。

5、房间表:房间ID,房间名,房间容量,房间类别,是否预定,位置,

6、桌子表:桌子ID,名称,座位数量,桌台状态,备注说明,房间号,员工ID

7、菜肴表: 菜肴ID,名称,详细说明,类别,主要原材料,照片,单价,折扣,有效标志,建立日期,推荐程度,口味,

8、菜单表:菜单ID,菜肴编号,菜肴数量,菜肴单价,菜肴撤菜数量,菜肴实际数量,结帐时间,预结算金额,折扣,实际金额,桌子ID,顾客ID

9、厨师做菜表:厨师ID,菜单号,时间,桌号 数据库:点菜系统管理 1.员工表 列名 数据类型 长度 主默认规则 键 约束 员工ID 姓名 性别 出生日期 联系电话 员工类别 薪水 char varchar 2 Datetime Char varcahr money 4 10 2 8 12 20 8,2 是 否 否 否 否 否 否 否 否 是否为空 否 否 “男” 是 是 长度为12 否 普通,低管,高是 管 1500---10000之是 间 备注 从业日期 datetime 8 管理员ID char 2.管理员表

4 Getdate() 是 否 6

数据库系统设计实训报告

列名 数据类长度 型 管理员Char 4 ID 姓名 varchar 10 性别 char 2 密码 Char 6 联系电char 12 话 3.顾客表 主键 是 否 否 否 否 默认约规则 束 长度为12 规则 是否为备注 空 否 否 是 否 否 列名 顾客ID 姓名 性别 顾客类别 数据类型 长度 Char varchar char Char 6 10 2 4 主键 是 否 否 否 默认约束 普通 是否为空 否 否 是 否 备注 金牌,银牌,铜牌,铁牌,普通 口味说明 备注 0为男,1为女 联系电char 12 话 出生日Datetime 8 期 喜好 varchar 100 单位 地址 4、厨师表 否 否 否 否 否 主键 是 否 否 否 否 默认约束 长度为否 12 是 规则 是 是 是 是否为空 否 否 是 varchar 50 varchar 100 数据类型 长度 列名 厨师ID Char 6 姓名 varchar 10 性别 char 2 联系电char 12 话 擅长菜varchar 100 系 5、房间表

长度为否 12 是 列名 数据类型 长度 主键 默认约规则 束 是否为备注 空 7

数据库系统设计实训报告

房间ID 房间名 房间容量 房间类别 是否预定 位置 6、桌子表 Char 6 varchar 20 int 4 char bit 8 1 是 否 否 否 否 否 主键 是 否 否 否 否 否 否 10 0 默认约束 10 0 规则 否 否 是 否 是 否 是否为空 否 否 否 否 是 否 否 0为未预定 备注 房间表的外键 员工表的外键 备注 图片的路径 0为无效,1有效 8

varchar 50 数据类型 长度 Char 6 varchar 20 int 4 char 10 列名 桌子ID 名称 座位数量 桌台状态 备注说明 房间ID varchar 100 char 6 4 员工ID char 7、菜肴表 列名 菜肴ID 名称 详细说明 类别 主要原材料 照片 单价 折扣 数据类型 长度 Char 6 varchar 20 int 4 varChar 20 varchar 100 varchar 50 money decimal 9,2 1 主键 是 否 否 否 否 否 否 否 默认约束 规则 10 0 1 是否为空 否 否 是 否 否 有效标bit 志 否 介于是 0--1 否 建立日datetime 8

否 Getdate() 否 数据库系统设计实训报告

期 推荐程char 度 口味 8、菜单表 4 是 是 Varchar 100 数据长度 类型 Char 8 Char 6 int 4 money 8,2 int 4 int 4 8 9,2 9,2 8 6 是 主键 是 是 否 否 否 否 否 否 否 否 是 1星,2星,3星 列名 菜单ID 菜肴ID 菜肴数量 菜肴单价 菜肴撤菜数量 菜肴实际数量 结帐时间 默认约束 规则 1 0 1 是否为备注 空 否 否 为菜肴表外键 否 否 否 否 否 否 否 否 否 0--1 为桌子表外键 为顾客表外键 datetime 预结算金decim额 al 折扣 decimal 实际金额 money 桌子ID Char Getdate() 1 0--1 顾客ID Char 6 否 否 9、厨师做菜表:厨师ID,菜单号,时间(修改了) 列名 数据类型 长度 主键 默认约规则 束 厨师ID Char 6 是 菜单号 Char 8 时间 Datetime 1 10 顾客折扣表 列名 顾客类char 4 别 折扣 decimal 9,2

否 0 是否为备注 空 否 否 为菜单表外键 否 9

数据库系统设计实训报告

create table 管理员表(

管理员ID char(4) primary key, 姓名 varchar(10) not null, 性别 char(2) default '男', 密码 char(6) not null,

联系电话 char(12) not null, create table 员工表(

员工ID char(4) primary key, 姓名 varchar(10) Not null, 性别 Char(2) default ('男'), 出生日期 Datetime,

联系电话Char(12) not null,

员工类别 varchar(20) check(员工类别 in('普通','低管','高管')), 薪水 money check(薪水 between 1500 and 15000), 从业日期 datetime default Getdate(), 管理员ID char(4) not null,

foreign key (管理员ID) references 管理员表(管理员ID)) create table 顾客表(

顾客ID char(6) primary key, 姓名 varchar(10) not null, 性别 char(2),

顾客类型 char(4) default('普通') check(顾客类型 in ('金牌','银牌','铜牌','铁牌','普通')),

联系电话 char(12) not null, 出生日期 datetime, 喜好 varchar(100), 单位 varchar(50), 地址 varchar(100),

折扣 decimal(5,2) check(折扣 between 0 and 1), 累计消费金额 decimal not null,) create table 厨师表(

厨师ID char(6) primary key, 姓名 varchar(10) not null,

性别 char(2) check(性别 in('男','女')) , 联系电话 char(12) not null, 擅长菜系 varchar(100),)

10

数据库系统设计实训报告

实验四 点菜系统数据库安全保密设计与实现

一、 实验目的

掌握数据库设计中安全保密设计与实现的方法。

二、 实验原理

数据库设计的安全保密设计与实现的方法。

三、 主要仪器及耗材

计算机、SQL SERVER 2000。

四、 实验内容与步骤

一.点菜系统数据库的安全保密设计与实现。

1.设置混合身份验证模式

2. 创建登录 ID 为wang,密码为’dongdong’,并指定默认数据库为点菜系统数据库。

3.通过SQL命令创建数据库角色

1)在当前数据库中创建名为ROLE1 的新角色。 2)将一个登录账号添加为点菜数据库的用户

EXEC sp_addlogin 'wang', 'dongdong', '点菜系统管理' go

EXEC sp_addrole 'ROLE1' go

EXEC sp_grantdbaccess 'WANG', 'WANG'

11

数据库系统设计实训报告

实验五 点菜系统数据库SQL Server查询与备份

一、 实验目的

掌握数据库中SQL查询语句及为数据库备份的方法。

二、 实验原理

数据库中SQL查询语句的应用,数据备份的方法。

三、 主要仪器及耗材

计算机、SQL SERVER 2000。

四、 实验内容与步骤

1. 点菜系统数据库中SQL Server查询.

(请自行写出关于点菜系统数据中常用的查询) (请自行写出关于点菜系统数据中常用的查询)

Adodc1.RecordSource = \"select * from 员工表 where 姓名='\" & Text1.Text & \"'or 员工ID='\" & Text2.Text & \"'or 员工类别='\" & Text3.Text & \"'\" 在点菜系统中运用到的select语句都是经过与数据库系统连接并在数据库中按照指定的数据表或条件查询相应的数据。*表示所有数据。

2.点菜系统数据库中的备份,对点菜系统数据库作完全备份,并保留备份文件。 备份数据库在数据库中右击需要备份的数据库选择所有任务选择备份数据库。在弹出的对话框中选择完全单选按钮,并单击添加按钮。在弹出的对话框中选择文件保存路径并输入文件名,单击确定,确定。数据库分离成功。

12

数据库系统设计实训报告

实验七 VB+SQL Server应用编程(一)

一、 实验目的

掌握数据库中SQL Server 2000与Visual Basic 连接的方法,学会进行简单的系统设计与实现。

二、 实验原理

数据库中SQL Server 2000与Visual Basic 连接,进行简单的系统设计与实现。

三、 主要仪器及耗材

计算机、Visual Basic 6.0 ,SQL SERVER 2000。

四、 实验内容与步骤

1、创建项目

2、VB与数据库的互连(请写出连接的代码)。

Public Function Cnn() As ADODB.Connection '定义函数 Set Cnn = New ADODB.Connection '返回一个数据库连接 Cnn.Ope Provider=SQLOLEDB.1;Persist Security

Info=False;User ID=sa;Initial Catalog=点菜系统_廖淑芳;Data Source=q30260 End Functio

3、设计窗体(对各窗体进行截图)。

1、登录界面

Private Sub Command1_Click()

Adodc1.RecordSource = \"select * from 管理员表 where 姓名 ='\" & Text1.Text & \"' and 密码='\" & Text2.Text & \"'\" Adodc1.Refresh

If Adodc1.Recordset.RecordCount > 0 Then

13

数据库系统设计实训报告

MDIForm1.Show Unload Me Else

MsgBox \"错误用户名或密码\Text1.Text = \"\" Text2.Text = \"\" End If End Sub

Private Sub Image1_Click() End Sub

Private Sub Form_Load() End Sub

2、MDIF主页面

Private Sub 点菜信_Click() Unload Me

d点菜信息Form4.Show End Sub

Private Sub 顾客_Click() Unload Me

g顾客查询.Show End Sub

Private Sub 顾客信_Click() Unload Me

g顾客信息表.Show End Sub

Private Sub 间查_Click() Unload Me

f房间查询.Show End Sub

Private Sub 息表_Click() Unload Me

y员工信息表询form3.Show End Sub

Private Sub 询_Click() Unload Me

c员工查询.Show End Sub

Private Sub 账_Click() Unload Me j结账.Show End Sub

14

数据库系统设计实训报告

3、员工查询

Private Sub Command1_Click()

Adodc1.RecordSource = \"select * from 员工表 where 姓名='\" & Text1.Text & \"'or 员工ID='\" & Text2.Text & \"'or 员工类别='\" & Text3.Text & \"'\" Adodc1.Refresh

If Adodc1.Recordset.RecordCount > 0 Then Set rs = Adodc1.Recordset

Set c员工查询Form2.DataGrid1.DataSource = rs c员工查询Form2.DataGrid1.Refresh Else

MsgBox \"很抱歉,没有找到该员工信息!\Text1.Text = \"\" Text2.Text = \"\" Text3.Text = \"\"

15

数据库系统设计实训报告

End If End Sub

Private Sub Command2_Click() Unload Me MDIForm1.Show End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = fx()

Adodc1.RecordSource = \"select * from 员工表 where 员工类别 ='' \" Set DataGrid1.DataSource = Adodc1 End Sub

8、房间查询

Private Sub Command1_Click()

Adodc1.RecordSource = \"select * from 房间表 where 房间名='\" & Text1.Text & \"'or 房间ID='\" & Text2.Text & \"'or 房间类别='\" & Text3.Text & \"'\" Adodc1.Refresh

If Adodc1.Recordset.RecordCount > 0 Then Set rs = Adodc1.Recordset

Set form7房间查询.DataGrid1.DataSource = rs form7房间查询.DataGrid1.Refresh Else

MsgBox \"很抱歉,没有找到该房间信息!\Text1.Text = \"\" Text2.Text = \"\" Text3.Text = \"\" End If End Sub

Private Sub Command2_Click() Unload Me MDIForm1.Show

16

数据库系统设计实训报告

End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = fx()

Adodc1.RecordSource = \"select* from 房间表 where 房间类别 ='' \" Set DataGrid1.DataSource = Adodc1 End Sub

10、顾客查询

Private Sub Command1_Click()

Adodc1.RecordSource = \"select * from 顾客表 where 姓名='\" & Text1.Text & \"'or 顾客ID='\" & Text2.Text & \"'or 顾客类型='\" & Text3.Text & \"'\" Adodc1.Refresh

If Adodc1.Recordset.RecordCount > 0 Then Set rs = Adodc1.Recordset

Set Form8顾客查询.DataGrid1.DataSource = rs Form8顾客查询.DataGrid1.Refresh Else

MsgBox \"很抱歉,没有找到该员工信息!\Text1.Text = \"\" Text2.Text = \"\" Text3.Text = \"\" End If End Sub

Private Sub Command2_Click() Unload Me MDIForm1.Show End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = fx()

Adodc1.RecordSource = \"select* from 顾客表 where 顾客类型 ='' \" Set DataGrid1.DataSource = Adodc1 End Sub

11、顾客信息设置

17

数据库系统设计实训报告

Private Sub Command1_Click()

Text1.Text = Adodc1.Recordset.Fields(0).Value Text2.Text = Adodc1.Recordset.Fields(1).Value Text3.Text = Adodc1.Recordset.Fields(2).Value Text4.Text = Adodc1.Recordset.Fields(3).Value Text5.Text = Adodc1.Recordset.Fields(4).Value

Text6.Text = CStr(Adodc1.Recordset.Fields(5).Value) Text7.Text = Adodc1.Recordset.Fields(6).Value Text8.Text = Adodc1.Recordset.Fields(7).Value Text9.Text = Adodc1.Recordset.Fields(8).Value Text10.Text = Adodc1.Recordset.Fields(9).Value Text11.Text = Adodc1.Recordset.Fields(10).Value End Sub

Private Sub Command2_Click()

c = MsgBox(\"你确定要删除吗?\If c = vbOK Then

Adodc1.Recordset.Delete Adodc1.Refresh End If End Sub

Private Sub Command3_Click()

Text1.Text = Adodc1.Recordset.Fields(0).Value Text2.Text = Adodc1.Recordset.Fields(1).Value Text3.Text = Adodc1.Recordset.Fields(2).Value Text4.Text = Adodc1.Recordset.Fields(3).Value Text5.Text = Adodc1.Recordset.Fields(4).Value

Text6.Text = CStr(Adodc1.Recordset.Fields(5).Value) Text7.Text = Adodc1.Recordset.Fields(6).Value Text8.Text = Adodc1.Recordset.Fields(7).Value Text9.Text = Adodc1.Recordset.Fields(8).Value Text10.Text = Adodc1.Recordset.Fields(9).Value Text11.Text = Adodc1.Recordset.Fields(10).Value End Sub

18

数据库系统设计实训报告

Private Sub Command4_Click() Adodc1.Recordset.Update

Adodc1.Recordset.Fields(0).Value = Text1.Text Adodc1.Recordset.Fields(1).Value = Text2.Text Adodc1.Recordset.Fields(2).Value = Text3.Text Adodc1.Recordset.Fields(3).Value = Text4.Text Adodc1.Recordset.Fields(4).Value = Text5.Text Adodc1.Recordset.Fields(5).Value = Text6.Text Adodc1.Recordset.Fields(6).Value = Text7.Text Adodc1.Recordset.Fields(7).Value = Text8.Text Adodc1.Recordset.Fields(8).Value = Text9.Text Adodc1.Recordset.Fields(9).Value = Text10.Text Adodc1.Recordset.Fields(10).Value = Text11.Text Adodc1.Recordset.UpdateBatch DataGrid1.Refresh End Sub

Private Sub Command5_Click() Text1.Text = \"\" Text2.Text = \"\" Combo1.Text = \"\" Combo2.Text = \"\" Text3.Text = \"\" Text4.Text = \"\" Text5.Text = \"\" Text6.Text = \"\" TText7.Text = \"\" Text8.Text = \"\" Text9.Text = \"\" Text10.Text = \"\" Text11.Text = \"\" End Sub

Private Sub Command6_Click()

If Text1.Text = \"\" Or Text2.Text = \"\" Or Text4.Text = \"\" Or Text5.Text = \"\" Or Text7.Text = \"\" Or Combo1.Text = \"\" Or Combo2.Text = \"\" Then MsgBox \"请完善数据!\提示\不能为空且满足约束\" End If

Adodc1.Recordset.AddNew

Adodc1.Recordset.Fields(0).Value = Text1.Text Adodc1.Recordset.Fields(1).Value = Text2.Text Adodc1.Recordset.Fields(2).Value = Text3.Text Adodc1.Recordset.Fields(3).Value = Text4.Text Adodc1.Recordset.Fields(4).Value = Text5.Text Adodc1.Recordset.Fields(5).Value = Text6.Text

19

数据库系统设计实训报告

Adodc1.Recordset.Fields(6).Value = Text7.Text Adodc1.Recordset.Fields(7).Value = Text8.Text Adodc1.Recordset.Fields(8).Value = Text9.Text Adodc1.Recordset.Fields(9).Value = Text10.Text Adodc1.Recordset.Fields(10).Value = Text11.Text Adodc1.Recordset.UpdateBatch DataGrid1.Refresh

MsgBox \"数据保存成功\提示\" saveerr:

MsgBox Err.Description End Sub

Private Sub Command7_Click() Unload Me MDIForm1.Show End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = fx() Adodc1.ConnectionString = fx() Adodc1.CommandType = adCmdText

Adodc1.RecordSource = \"select * from 顾客表 order by 顾客ID\" Set DataGrid1.DataSource = Adodc1 Adodc1.Refresh End Sub

12、点菜页面

Private Sub Command1_Click()

Text1.Text = Adodc1.Recordset.Fields(0).Value Text2.Text = Adodc1.Recordset.Fields(4).Value Text3.Text = Adodc1.Recordset.Fields(1).Value Text4.Text = Adodc1.Recordset.Fields(11).Value Text5.Text = Adodc1.Recordset.Fields(6).Value If Adodc1.Recordset.Fields(8).Value = 0 Then

20

数据库系统设计实训报告

Check1.Value = Unchecked Else

Check1.Value = Checked End If

p = Adodc1.Recordset.Fields(5).Value

Picture1.Picture = LoadPicture(App.Path & p) End Sub

Private Sub Command2_Click() q确定点菜Form5.Show End Sub

Private Sub Command3_Click() Text1.Text = \"\" Text2.Text = \"\" Text3.Text = \"\" Text4.Text = \"\" Text5.Text = \"\" End Sub

Private Sub Command4_Click() Unload Me MDIForm1.Show End Sub

Private Sub DataGrid1_Click() Adodc1.ConnectionString = fx()

Adodc1.RecordSource = \"select * from 菜肴表 \" Set DataGrid1.DataSource = Adodc1 End Sub 13、结帐

Private Sub Command1_Click() Form8顾客查询.Show End Sub

Private Sub Command2_Click()

Adodc1.RecordSource = \"select * from 点菜表 where 桌子ID='\" + Text4.Text + \"'\" Adodc1.Refresh

21

数据库系统设计实训报告

Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh

If Adodc1.Recordset.RecordCount > 0 Then

Text7.Text = Adodc1.Recordset.Fields(3).Value End If End Sub

Private Sub Command3_Click() Unload Me MDIForm1.Show End Sub

Private Sub Command4_Click() Dim p As Double

p = Val(Text6.Text) * Val(Text5.Text) Text8.Text = p End Sub

Private Sub Command5_Click() Adodc1.ConnectionString = fx() Adodc1.CommandType = adCmdText

Adodc1.RecordSource = \"select * from 帐单表\" Set DataGrid1.DataSource = Adodc1 Adodc1.Refresh

On Error GoTo saveerr

If Text1.Text = \"\" Or Text8.Text = \"\" Then

MsgBox \"请完善数据!\提示\不能为空且 满足约束\" End If

Adodc1.Recordset.AddNew

Adodc1.Recordset.Fields(1).Value = Text1.Text Adodc1.Recordset.Fields(2).Value = Text7.Text Adodc1.Recordset.Fields(3).Value = Text8.Text Adodc1.Recordset.Fields(4).Value = Text10.Text Adodc1.Recordset.Fields(5).Value = Text11.Text Adodc1.Recordset.Fields(6).Value = Text8.Text Adodc1.Recordset.UpdateBatch MsgBox \"数据保存成功\提示\" saveerr:

MsgBox Err.Description End Sub

Private Sub Command6_Click() Dim sum As Double

sum = Val(Text10.Text) - Val(Text8.Text) If sum >= 0 Then Text9.Text = sum Else

MsgBox \"你所付的费用不够!\"

22

数据库系统设计实训报告

Text4.Text = \"\" Text4.SetFocus End If End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = fx()

Adodc1.RecordSource = \"select * from 帐单表 order by 帐单ID\" Text9.Text = j结账Form6.Text2.Text Text11.Text = j结账Form6.Text3.Text Set DataGrid1.DataSource = Adodc1 End Sub

14、员工信息设置

Private Sub Command1_Click()

Text1.Text = Adodc1.Recordset.Fields(0).Value Text2.Text = Adodc1.Recordset.Fields(1).Value Text3.Text = Adodc1.Recordset.Fields(2).Value

Text4.Text = CStr(Adodc1.Recordset.Fields(3).Value) Text5.Text = (Adodc1.Recordset.Fields(4).Value) Text6.Text = Adodc1.Recordset.Fields(5).Value Text7.Text = Adodc1.Recordset.Fields(6).Value

Text8.Text = CStr(Adodc1.Recordset.Fields(7).Value) End Sub

Private Sub Command2_Click()

c = MsgBox(\"你确定要删除吗?\If c = vbOK Then

Adodc1.Recordset.Delete Adodc1.Refresh End If End Sub

Private Sub Command3_Click()

Text1.Text = Adodc1.Recordset.Fields(0).Value

23

数据库系统设计实训报告

Text2.Text = Adodc1.Recordset.Fields(1).Value Text3.Text = Adodc1.Recordset.Fields(2).Value

Text4.Text = CStr(Adodc1.Recordset.Fields(3).Value) Text5.Text = (Adodc1.Recordset.Fields(4).Value) Text6.Text = Adodc1.Recordset.Fields(5).Value Text7.Text = Adodc1.Recordset.Fields(6).Value

Text8.Text = CStr(Adodc1.Recordset.Fields(7).Value) End Sub

Private Sub Command4_Click() Adodc1.Recordset.Update

Adodc1.Recordset.Fields(0).Value = Text1.Text Adodc1.Recordset.Fields(1).Value = Text2.Text Adodc1.Recordset.Fields(2).Value = Text3.Text Adodc1.Recordset.Fields(3).Value = Text4.Text Adodc1.Recordset.Fields(4).Value = Text5.Text Adodc1.Recordset.Fields(5).Value = Text6.Text Adodc1.Recordset.Fields(6).Value = Text7.Text Adodc1.Recordset.Fields(7).Value = Text8.Text Adodc1.Recordset.UpdateBatch DataGrid1.Refresh End Sub

Private Sub Command5_Click() Text1.Text = \"\" Text2.Text = \"\" Combo1.Text = \"\" Combo2.Text = \"\" Text3.Text = \"\" Text4.Text = \"\" Text5.Text = \"\" Text6.Text = \"\" Text7.Text = \"\" End Sub

Private Sub Command6_Click()

If Text1.Text = \"\" Or Text2.Text = \"\" Or Text4.Text = \"\" Or Text5.Text = \"\" Or Text7.Text = \"\" Or Combo1.Text = \"\" Or Combo2.Text = \"\" Then MsgBox \"请完善数据!\提示\不能为空且满足约束\" End If

Adodc1.Recordset.AddNew

Adodc1.Recordset.Fields(0).Value = Text1.Text Adodc1.Recordset.Fields(1).Value = Text2.Text Adodc1.Recordset.Fields(2).Value = Text3.Text Adodc1.Recordset.Fields(3).Value = Text4.Text Adodc1.Recordset.Fields(4).Value = Text5.Text Adodc1.Recordset.Fields(5).Value = Text6.Text

24

数据库系统设计实训报告

Adodc1.Recordset.Fields(6).Value = Text7.Text Adodc1.Recordset.Fields(7).Value = Text8.Text Adodc1.Recordset.UpdateBatch DataGrid1.Refresh

MsgBox \"数据保存成功\提示\" saveerr:

MsgBox Err.Description End Sub

Private Sub Command7_Click() Unload Me MDIForm1.Show End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = fx() Adodc1.ConnectionString = fx() Adodc1.CommandType = adCmdText

Adodc1.RecordSource = \"select * from 员工表 order by 员工ID\" Set DataGrid1.DataSource = Adodc1 Adodc1.Refresh End Sub

Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single) End Sub

25

因篇幅问题不能全部显示,请点此查看更多更全内容

Top