⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcancelreserve.frm

📁 酒店课房管理系统。完成酒店的客房入住
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCancelReserve 
   Caption         =   "取消顾客预定"
   ClientHeight    =   5685
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6900
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5685
   ScaleWidth      =   6900
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame3 
      Height          =   4335
      Left            =   4440
      TabIndex        =   9
      Top             =   720
      Width           =   1575
      Begin VB.CommandButton Command2 
         Caption         =   "退出"
         Height          =   495
         Left            =   120
         TabIndex        =   11
         Top             =   3360
         Width           =   1335
      End
      Begin VB.CommandButton cmdCancelReserve 
         Caption         =   "取消预定"
         Height          =   495
         Left            =   120
         TabIndex        =   10
         Top             =   480
         Width           =   1335
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "顾客预定信息"
      Height          =   3375
      Left            =   360
      TabIndex        =   2
      Top             =   1680
      Width           =   3975
      Begin VB.Label labPrice 
         AutoSize        =   -1  'True
         Height          =   195
         Left            =   2040
         TabIndex        =   17
         Top             =   2880
         Width           =   45
      End
      Begin VB.Label labReserveDate 
         AutoSize        =   -1  'True
         Height          =   195
         Left            =   1440
         TabIndex        =   16
         Top             =   2400
         Width           =   45
      End
      Begin VB.Label labCreditCardNo 
         AutoSize        =   -1  'True
         Height          =   195
         Left            =   1440
         TabIndex        =   15
         Top             =   1920
         Width           =   45
      End
      Begin VB.Label labCustPhoneNo 
         AutoSize        =   -1  'True
         Height          =   195
         Left            =   1320
         TabIndex        =   14
         Top             =   1440
         Width           =   45
      End
      Begin VB.Label labCustAddress 
         AutoSize        =   -1  'True
         Height          =   195
         Left            =   960
         TabIndex        =   13
         Top             =   960
         Width           =   45
      End
      Begin VB.Label labCustName 
         AutoSize        =   -1  'True
         Height          =   195
         Left            =   960
         TabIndex        =   12
         Top             =   480
         Width           =   45
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "预定房间所付定金:"
         Height          =   195
         Left            =   360
         TabIndex        =   8
         Top             =   2880
         Width           =   1485
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "预定日期:"
         Height          =   195
         Left            =   360
         TabIndex        =   7
         Top             =   2400
         Width           =   765
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "信用卡号码:"
         Height          =   195
         Left            =   360
         TabIndex        =   6
         Top             =   1920
         Width           =   945
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "电话号码:"
         Height          =   195
         Left            =   360
         TabIndex        =   5
         Top             =   1440
         Width           =   765
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "地址:"
         Height          =   195
         Left            =   360
         TabIndex        =   4
         Top             =   960
         Width           =   405
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓名:"
         Height          =   195
         Left            =   360
         TabIndex        =   3
         Top             =   480
         Width           =   405
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "请选择要取消预定的房间号"
      Height          =   855
      Left            =   360
      TabIndex        =   0
      Top             =   720
      Width           =   3975
      Begin VB.ComboBox cboRoomNo 
         Height          =   315
         Left            =   240
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   360
         Width           =   3255
      End
   End
End
Attribute VB_Name = "frmCancelReserve"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private cnnHotel As New ADODB.Connection
Private rsCustReserveInfo As New ADODB.Recordset
Private rsRooms As New ADODB.Recordset

Private Sub cboRoomNo_Click()
     rsCustReserveInfo.Open "SELECT * FROM CustReserveInfo WHERE 顾客预定房间号='" & cboRoomNo.Text & "'", cnnHotel, adOpenKeyset, adLockOptimistic  '打开记录集
     Set labCustName.DataSource = rsCustReserveInfo
     labCustName.DataField = "顾客姓名"
     
     Set labCustAddress.DataSource = rsCustReserveInfo
     labCustAddress.DataField = "顾客地址"
     
     Set labCustPhoneNo.DataSource = rsCustReserveInfo
     labCustPhoneNo.DataField = "顾客电话号码"
     
     Set labCreditCardNo.DataSource = rsCustReserveInfo
     labCreditCardNo.DataField = "顾客信用卡号"
     
     Set labReserveDate.DataSource = rsCustReserveInfo
     labReserveDate.DataField = "顾客预定房间日期"
     
     Set labPrice.DataSource = rsCustReserveInfo
     labPrice.DataField = "顾客预定房间所付定金"
     
     rsCustReserveInfo.Close
End Sub


Private Sub cmdCancelReserve_Click()
    If cboRoomNo.Text = "" Then
        MsgBox "请选择一个顾客已经预定的房间号!", vbInformation, "提示"
        Exit Sub
    Else
        rsCustReserveInfo.Open "SELECT * FROM CustReserveInfo WHERE 顾客预定房间号='" & cboRoomNo.Text & "'", cnnHotel, adOpenKeyset, adLockOptimistic  '打开新记录集
        rsRooms.Open "SELECT * FROM Rooms WHERE 房间号=" & "'" & cboRoomNo.Text & "'", cnnHotel, adOpenKeyset, adLockOptimistic    '打开新记录集
        
        cnnHotel.BeginTrans
            rsCustReserveInfo.Delete
            rsCustReserveInfo.MoveFirst   '移到第一个记录
            
            rsRooms.Update "房间预定日期", ""
            rsRooms.Update "房间状态", "空闲"          '修改房间状态
            rsRooms.Update "顾客姓名", ""
        cnnHotel.CommitTrans
        MsgBox "顾客预定信息已经成功删除!", vbInformation, "删除顾客信息"
        Unload frmCancelReserve
    End If
End Sub

Private Sub Command2_Click()
    Unload frmCancelReserve
End Sub

Private Sub Form_Load()
    cnnHotel.Provider = "Microsoft.Jet.OLEDB.3.51"
    cnnHotel.Open "User ID=admin;Data Source=" & GetDBPath() '建立与数据库的连接
    rsRooms.Open "SELECT 房间号,房间状态 FROM Rooms WHERE 房间状态='已预定'", cnnHotel, adOpenKeyset, adLockOptimistic   '打开新记录集
    Do While Not rsRooms.BOF And Not rsRooms.EOF  '当rsRooms.BOF,rsRooms.EOF都为False 时
        cboRoomNo.AddItem rsRooms.Fields("房间号")  '在cboRoomNo 的下拉列表选项中加如当前的空闲房间号
        rsRooms.MoveNext   '移到下一条记录
    Loop
    rsRooms.Close
End Sub

Private Sub Form_Unload(Cancel As Integer)
    cnnHotel.Close
End Sub

Private Sub Label10_Click()

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -