旅游管理系统实验报告
实验目的
1、掌握常用内部控件的主要属性、事件和方法,利用常用控件进行程序设计。 2、掌握VB程序的一些简单的程序的设计与代码的编写。
实验要求
1、建立一个旅游管理查询系统,实现其管理查询等功能。
2、要实现路线添加及查询、导游查询、组团管理、游客查询等主要功能。
实验步骤
用VB建立主界面: (1)界面设计。
参照下图设置程序界面;窗体及各控件属性设置如下:
(2)设计登陆界面,其中用到滚动字幕,用到以下代码: Private Sub Timer2_Timer()
Label1.Left = CInt(Label1.Left) + 10 End Sub
(3)建立数据库,运用数据库进行信息存储、查询以及调用。如:
旅游线路基本信息表
编号 字段名称 数据类型 1 Lid Int 2 Lname Varchar 50 3 Lday Smallint 4 Ltype Smallint 5 OtherCost Decimal 8,2 6 TourPay Decimal 8,2 7 Benefit Decimal 8,2 实现路线添加,其代码如下: Dim res As Integer
res = MsgBox(\"确实添加此记录!\vbDefaultButton2) '提示用户
If res = vbYes Then '如果确实要添加 Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(\"名称\").Value = Trim(Text1.Text) Adodc1.Recordset.Fields(\"主要景点\").Value = Trim(Text2.Text) Adodc1.Recordset.Fields(\"行程天数\").Value = Trim(Text3.Text) Adodc1.Recordset.Fields(\"报价\").Value = Trim(Text4.Text)
备注 旅游线路编号 旅游线路名称 旅游线路全程天数 旅游团组 其他费用 导游费 利润 Adodc1.Recordset.Fields(\"住宿天数\").Value = Trim(Text5.Text) Adodc1.Recordset.Fields(\"行程安排\").Value = Trim(Text6.Text) Adodc1.Recordset.Fields(\"说明\").Value = Trim(Text7.Text) Adodc1.Recordset.Fields(\"编号\").Value = Trim(Text8.Text) Adodc1.Recordset.Update MsgBox \"恭喜你添加成功\" Adodc1.Refresh
(4)旅游线路景点代码及界面 Adodc1.CommandType = adCmdText
Adodc1.RecordSource = \"select*from 旅游线路表单 \"
Adodc1.Refresh
(5)实现游客管理,设计时要用到以下代码:
If Combo1.Text = \"\" Then MsgBox (\"请先选择游客性别.\") Exit Sub End If
If Combo1.Text = \"男\" Then Adodc1.CommandType = adCmdText
Adodc1.RecordSource = \"select*from 游客表单 where 性别 = '男'\" Adodc1.Refresh DataGrid1.Visible = True Exit Sub End If
If Combo1.Text = \"女\" Then Adodc1.CommandType = adCmdText
Adodc1.RecordSource = \"select*from 游客表单 where 性别 = '女'\" Adodc1.Refresh DataGrid1.Visible = True
实验心得
通过这次用VB做旅游管理系统,感觉能把自己所学到的知识运用到实践中去,是比较欣慰的,当然在做这个系统期间,我也发现有很多东西是需要我们在课后学习的。由于能力有限,系统存在的不足希望老师能提出意见和建议。谢谢!
因篇幅问题不能全部显示,请点此查看更多更全内容