setroom1.frm

来自「星级酒店客房管理系统一套很不错的系统」· FRM 代码 · 共 428 行 · 第 1/2 页

FRM
428
字号
      Begin VB.Label Label1 
         Caption         =   "房  号:"
         Height          =   300
         Left            =   630
         TabIndex        =   1
         Top             =   420
         Width           =   840
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2130
      Top             =   885
      Visible         =   0   'False
      Width           =   1635
      _ExtentX        =   2884
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=LCHOTEL"
      OLEDBString     =   "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=LCHOTEL"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "setroom1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Unload Me
End Sub

Private Sub Command2_Click()
Dim i
    Select Case RoomForm_Type
    Case "增加"
        Adodc1.ConnectionString = My_PROVIDER
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = "select * from 客房"
        Adodc1.Refresh
        
        '查询房号是否重复设置
        For i = 1 To Adodc1.Recordset.RecordCount
        If Adodc1.Recordset.Fields("房号") = Me.Text1.Text And Adodc1.Recordset.Fields("楼号") = Me.Text2.Text Then
        MsgBox Me.Text1.Text & "房号已经设置!"
        Unload Me
        Else
        Adodc1.Recordset.AddNew
        Adodc1.Recordset.Fields("房号") = Me.Text1.Text
        Adodc1.Recordset.Fields("楼号") = Me.Text2.Text
        Adodc1.Recordset.Fields("层") = Me.Text3.Text
        Adodc1.Recordset.Fields("日房价") = Me.Text4.Text
        Adodc1.Recordset.Fields("床位数") = Me.Text5.Text
        Adodc1.Recordset.Fields("类型") = Me.Combo1.Text
        Adodc1.Recordset.Fields("当前状态") = Me.Combo2.Text
        Adodc1.Recordset.Fields("电话") = Me.Text7.Text
        Adodc1.Recordset.Fields("出售方式") = Me.Combo3.Text
        Adodc1.Recordset.Update
        End If
        Next
        Adodc1.Recordset.Close
    Case "修改"
        Adodc1.ConnectionString = My_PROVIDER
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
        Adodc1.Refresh
        If Adodc1.Recordset.RecordCount = 1 Then
        Adodc1.Recordset.Fields("房号") = Me.Text1.Text
        Adodc1.Recordset.Fields("楼号") = Me.Text2.Text
        Adodc1.Recordset.Fields("层") = Me.Text3.Text
        Adodc1.Recordset.Fields("日房价") = Me.Text4.Text
        Adodc1.Recordset.Fields("床位数") = Me.Text5.Text
        Adodc1.Recordset.Fields("类型") = Me.Combo1.Text
        Adodc1.Recordset.Fields("当前状态") = Me.Combo2.Text
        Adodc1.Recordset.Fields("电话") = Me.Text7.Text
        Adodc1.Recordset.Fields("出售方式") = Me.Combo3.Text
        Adodc1.Recordset.Update
        Adodc1.Recordset.Close
        Else
        If Adodc1.Recordset.RecordCount > 1 Then
        Adodc1.Recordset.MoveNext
        Adodc1.Recordset.Fields("房号") = Me.Text1.Text
        Adodc1.Recordset.Fields("楼号") = Me.Text2.Text
        Adodc1.Recordset.Fields("层") = Me.Text3.Text
        Adodc1.Recordset.Fields("日房价") = Me.Text4.Text
        Adodc1.Recordset.Fields("床位数") = Me.Text5.Text
        Adodc1.Recordset.Fields("类型") = Me.Combo1.Text
        Adodc1.Recordset.Fields("当前状态") = Me.Combo2.Text
        Adodc1.Recordset.Fields("电话") = Me.Text7.Text
        Adodc1.Recordset.Fields("出售方式") = Me.Combo3.Text
        Adodc1.Recordset.Update
        Adodc1.Recordset.Close
        Else
        Adodc1.Recordset.AddNew
        Adodc1.Recordset.Fields("房号") = Me.Text1.Text
        Adodc1.Recordset.Fields("楼号") = Me.Text2.Text
        Adodc1.Recordset.Fields("层") = Me.Text3.Text
        Adodc1.Recordset.Fields("日房价") = Me.Text4.Text
        Adodc1.Recordset.Fields("床位数") = Me.Text5.Text
        Adodc1.Recordset.Fields("类型") = Me.Combo1.Text
        Adodc1.Recordset.Fields("当前状态") = Me.Combo2.Text
        Adodc1.Recordset.Fields("电话") = Me.Text7.Text
        Adodc1.Recordset.Fields("出售方式") = Me.Combo3.Text
        Adodc1.Recordset.Update
        Adodc1.Recordset.Close
        End If
        
        End If
    End Select
    Unload Me
End Sub

Private Sub Form_Load()
    Adodc1.ConnectionString = My_PROVIDER
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from 项目编码 where 编码 like 'FL%' order by 名称"
    Adodc1.Refresh
    While Not Adodc1.Recordset.EOF
        Me.Combo1.AddItem Adodc1.Recordset.Fields("名称")
        If Adodc1.Recordset.Fields("首选项") = "是" Then
            Me.Combo1.Text = Adodc1.Recordset.Fields("名称")
        End If
        Adodc1.Recordset.MoveNext
    Wend
    Adodc1.Recordset.Close
    
    Adodc1.ConnectionString = My_PROVIDER
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from 房间状态"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        While Not Adodc1.Recordset.EOF
            Me.Combo2.AddItem Adodc1.Recordset.Fields("房间状态")
            Adodc1.Recordset.MoveNext
        Wend
    End If
    Combo2.Text = Combo2.list(0)
    Adodc1.Recordset.Close
    '出售方式
    Adodc1.RecordSource = "select * from 项目编码 where 编码 like 'FF%' order by 名称"
    Adodc1.Refresh
    While Not Adodc1.Recordset.EOF
        Me.Combo3.AddItem Adodc1.Recordset.Fields("名称")
        If Adodc1.Recordset.Fields("首选项") = "是" Then
            Me.Combo3.Text = Adodc1.Recordset.Fields("名称")
        End If
        Adodc1.Recordset.MoveNext
    Wend
    Adodc1.Recordset.Close
    Select Case RoomForm_Type
    Case "增加"
        Me.Label8.Caption = "增加客房资料"
        
    Case "修改"
        Me.Label8.Caption = "修改【" & RoomNO & "】客房资料"
        Adodc1.ConnectionString = My_PROVIDER
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
        Adodc1.Refresh
        If Adodc1.Recordset.RecordCount > 0 Then
            Me.Text1.Text = IIf(IsNull(Adodc1.Recordset.Fields("房号")), "", Adodc1.Recordset.Fields("房号"))
            Me.Text2.Text = IIf(IsNull(Adodc1.Recordset.Fields("楼号")), "", Adodc1.Recordset.Fields("楼号"))
            Me.Text3.Text = IIf(IsNull(Adodc1.Recordset.Fields("层")), "", Adodc1.Recordset.Fields("层"))
            Me.Text4.Text = IIf(IsNull(Adodc1.Recordset.Fields("日房价")), 0, Adodc1.Recordset.Fields("日房价"))
            Me.Text5.Text = IIf(IsNull(Adodc1.Recordset.Fields("床位数")), 0, Adodc1.Recordset.Fields("床位数"))
            Me.Combo1.Text = IIf(IsNull(Adodc1.Recordset.Fields("类型")), 0, Adodc1.Recordset.Fields("类型"))
            Me.Combo2.Text = IIf(IsNull(Adodc1.Recordset.Fields("当前状态")), 0, Adodc1.Recordset.Fields("当前状态"))
            Me.Combo3.Text = IIf(IsNull(Adodc1.Recordset.Fields("出售方式")), 0, Adodc1.Recordset.Fields("出售方式"))
        Else
            MsgBox "操作错误:您没有选择要修改的房间!", 48, "提示"
            Unload Me
        End If
    End Select
    
End Sub

Private Sub Text1_LostFocus()
If Text1.Text <> "" Then Text3.Text = Left(Text1.Text, 1)
End Sub

⌨️ 快捷键说明

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