VB宾馆客房管理系统(数据流图+ER图) 第2页
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo2.SetFocus
'查询客房信息
Data1.RecordSource = "select * from kf where 房间类型='" & Combo1.Text & "'"
Data1.Refresh
'赋值给texjg.text
If Data1.Recordset.RecordCount > 0 Then Texjg.Text = Data1.Recordset.Fields("价格")
End Sub
Private Sub texfjh_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo1.SetFocus '按回车键Combo1获得焦点
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texjg.SetFocus
End Sub
Private Sub texjg_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTP1.SetFocus
End Sub
Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texsz.SetFocus '按回车键Texsz获得焦点
End Sub
Private Sub texsz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texpz.SetFocus
End Sub
Private Sub texpz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texbz.SetFocus
End Sub
Private Sub texbz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Comsave.SetFocus
End Sub
Private Sub comdj_Click() '登记
Texfjh.Text = "": Texjg.Text = "": Texsz.Text = ""
Texpz.Text = "": Texbz.Text = ""
Comsave.Enabled = True: Comcancel.Enabled = True: Comdj.Enabled = False
Texfjh.SetFocus
End Sub
Private Sub comsave_Click()
'查找客房信息
Data1.Recordset.FindFirst "房间号 like" + Chr(34) + Texfjh.Text + Chr(34) + ""
If Data1.Recordset.NoMatch Then
'添加客房
Data1.Recordset.AddNew
If Texfjh.Text <> "" Then Data1.Recordset.Fields("房间号") = Texfjh.Text
If Combo1.Text <> "" Then Data1.Recordset.Fields("房间类型") = Combo1.Text
If Combo2.Text <> "" Then Data1.Recordset.Fields("房态") = Combo2.Text
If Texjg.Text <> "" Then Data1.Recordset.Fields("价格") = Texjg.Text
If DTP1.Value <> "" Then Data1.Recordset.Fields("营业日期") = DTP1.Value
If Texsz.Text <> "" Then Data1.Recordset.Fields("使用设置") = Texsz.Text
If Texpz.Text <> "" Then Data1.Recordset.Fields("配置") = Texpz.Text
If Texbz.Text <> "" Then Data1.Recordset.Fields("备注") = Texbz.Text
If Texfjh.Text <> "" Then Data1.Recordset.Fields("标志") = "0"
Data1.Recordset.Update '更新记录
Data1.Refresh
Else
'编辑客房信息
Data1.Recordset.Edit
If Texfjh.Text <> "" Then Data1.Recordset.Fields("房间号") = Texfjh.Text
If Combo2.Text <> "" Then Data1.Recordset.Fields("房态") = Combo2.Text
If Combo1.Text <> "" Then Data1.Recordset.Fields("房间类型") = Combo1.Text
If Texjg.Text <> "" Then Data1.Recordset.Fields("价格") = Texjg.Text
If DTP1.Value <> "" Then Data1.Recordset.Fields("营业日期") = DTP1.Value
If Texsz.Text <> "" Then Data1.Recordset.Fields("使用设置") = Texsz.Text
If Texpz.Text <> "" Then Data1.Recordset.Fields("配置") = Texpz.Text
If Texbz.Text <> "" Then Data1.Recordset.Fields("备注") = Texbz.Text
If Texfjh.Text <> "" Then Data1.Recordset.Fields("标志") = "0"
Data1.Recordset.Update '更新记录
Data1.Refresh
End If
'设置控件有效或无效
Comsave.Enabled = False: Comcancel.Enabled = False
Comend.Enabled = True: Comdj.Enabled = True
End Sub
Private Sub comcancel_Click() '取消操作
Texfjh.Text = "": Texjg.Text = "": Texsz.Text = ""
Texpz.Text = "": Texbz.Text = ""
Comsave.Enabled = False: Comcancel.Enabled = False: Comdj.Enabled = True
End Sub
Private Sub comend_Click()
main.Enabled = True
Unload Me
End Sub
[2] 客房查询的界面及代码:
代码: Private Sub Form_Load() '自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True
End Sub
Private Sub Text1_Change()
'查询客房信息
Data1.RecordSource = "select * from kf where kf.房间号 like " + Chr(34) + Text1.Text + "*" + Chr(34) + ""
Data1.Refresh
End Sub
Private Sub Command1_Click() '允许修改客房信息
DBGrid1.AllowUpdate = True
End Sub
Private Sub Command2_Click() '删除客房信息
If Data1.Recordset.RecordCount > 0 Then
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub
Private Sub Command3_Click()
main.Enabled = True
Unload Me
End Sub
上一页 [1] [2] [3] [4] [5] 下一页
VB宾馆客房管理系统(数据流图+ER图) 第2页下载如图片无法显示或论文不完整,请联系qq752018766