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

📄 form5.frm

📁 酒店管理系统(VB),很强大
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         End
         Begin VB.CommandButton Command6 
            Caption         =   "取消"
            BeginProperty Font 
               Name            =   "楷体_GB2312"
               Size            =   10.5
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   495
            Left            =   3360
            Style           =   1  'Graphical
            TabIndex        =   4
            Top             =   2280
            Width           =   1095
         End
         Begin VB.TextBox Text2 
            Height          =   375
            Left            =   -73800
            TabIndex        =   3
            Top             =   1320
            Width           =   1335
         End
         Begin VB.TextBox Text4 
            Height          =   375
            Left            =   -74280
            TabIndex        =   2
            Top             =   1440
            Width           =   2055
         End
         Begin VB.Label Label12 
            Caption         =   "/每人   每晚"
            Height          =   495
            Left            =   2760
            TabIndex        =   30
            Top             =   2400
            Width           =   615
         End
         Begin VB.Label Label11 
            Caption         =   "/每人   每晚"
            Height          =   495
            Left            =   -72360
            TabIndex        =   29
            Top             =   2520
            Width           =   615
         End
         Begin VB.Label Label10 
            Caption         =   "收费标准"
            Height          =   375
            Left            =   360
            TabIndex        =   27
            Top             =   2400
            Width           =   855
         End
         Begin VB.Label Label6 
            Caption         =   "收费标准"
            Height          =   255
            Left            =   -74640
            TabIndex        =   25
            Top             =   2520
            Width           =   735
         End
         Begin VB.Label Label4 
            Caption         =   "总床位数"
            Height          =   255
            Left            =   -74640
            TabIndex        =   23
            Top             =   1920
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "房间类型"
            Height          =   255
            Left            =   -74640
            TabIndex        =   22
            Top             =   720
            Width           =   735
         End
         Begin VB.Label Label2 
            Caption         =   "房间号码"
            Height          =   255
            Left            =   -74640
            TabIndex        =   21
            Top             =   1320
            Width           =   735
         End
         Begin VB.Label Label3 
            Caption         =   "性别"
            Height          =   255
            Left            =   -72120
            TabIndex        =   20
            Top             =   720
            Width           =   495
         End
         Begin VB.Label Label5 
            Caption         =   "请输入要删除的房间号码:"
            Height          =   255
            Left            =   -74280
            TabIndex        =   19
            Top             =   960
            Width           =   2175
         End
         Begin VB.Label Label7 
            Caption         =   "性别"
            Height          =   255
            Left            =   600
            TabIndex        =   18
            Top             =   1800
            Width           =   495
         End
         Begin VB.Label Label8 
            Caption         =   "请输入要修改的房间号码:"
            Height          =   255
            Left            =   600
            TabIndex        =   17
            Top             =   600
            Width           =   2175
         End
         Begin VB.Label Label9 
            Caption         =   "房间类型"
            Height          =   255
            Left            =   480
            TabIndex        =   16
            Top             =   1200
            Width           =   735
         End
      End
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public rs As ADODB.Recordset
Public db As ADODB.Connection
Private Sub Command1_Click()
Dim n As String
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=ZHANWEN\ZHANWEN;database=酒店管理;Persist Security Info=False;User ID=sa;pwd="

 db.Open
rs.Open "select * from 增删房间", db, adOpenStatic, adLockReadOnly
If Len(Trim(Text2.Text)) = 4 And Val(Trim(Text2.Text)) < 9999 And Val(Trim(Text2.Text)) > 0 Then
  
rs.Close
 rs.Open "select 房间号码 from 增删房间 where 房间号码 ='" & Trim(Text2.Text) & "'"
 If rs.EOF = False And rs.BOF = False Then

  n = MsgBox("此房间已有,请重填写!", vbExclamation)
  Text2.Text = ""
  Text2.SetFocus
Else
rs.Close
rs.Open " insert into 增删房间(房间类型,房间号码,性别,总床位数,收费标准) values ('" & Trim(Combo2.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Combo1.Text) & "','" & Trim(Text5.Text) & "','" & Trim(Text6.Text) & "')", db, adOpenStatic, adLockReadOnly

zengjia
n = MsgBox("你确定添加吗?", vbOKCancel)
Combo2.Text = ""
Text2.Text = ""
Combo1.Text = ""
Text5.Text = ""

End If
Else
n = MsgBox("房间号码为空或太大,请重填写!", vbExclamation)
  Text2.Text = ""
  Text2.SetFocus
  
End If
End Sub

Private Sub Command2_Click()
Unload Form5
End Sub

Private Sub Command3_Click()

Dim n As String
Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=ZHANWEN\ZHANWEN;database=酒店管理;Persist Security Info=False;User ID=sa;pwd="

db.Open
 
rs.Open "select * from 增删房间 where 房间号码='" & Text4.Text & "' ", db, adOpenStatic, adLockReadOnly

If rs.EOF = True And rs.BOF = True Then

n = MsgBox("没有此房间!", 48)
Text4.Text = ""
Text4.SetFocus
Else
rs.Close
rs.Open "delete from 增删房间 where 房间号码='" & Text4.Text & "'", db, adOpenStatic, adLockReadOnly

Text4.Text = ""

End If
End Sub

Private Sub Command4_Click()
Unload Form5
End Sub

Private Sub Command5_Click()

Dim n As String
Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
 db.ConnectionString = "driver={SQL Server};server=ZHANWEN\ZHANWEN;database=酒店管理;Persist Security Info=False;User ID=sa;pwd="

db.Open
 
rs.Open "select * from 增删房间 where 房间号码='" & Text3.Text & "' ", db, adOpenStatic, adLockReadOnly

If rs.EOF = True And rs.BOF = True Then

n = MsgBox("没有此房间或没填房间号!", 48)
Text3.Text = ""
Text3.SetFocus
Else
rs.Close
rs.Open "update 增删房间 set 房间类型='" & Combo6.Text & "',性别 ='" & Combo5.Text & "',收费标准='" & Text7.Text & "'  where 房间号码='" & Text3.Text & "'", db, adOpenStatic, adLockReadOnly
 
Text3.Text = ""
Combo6.Text = ""
Combo5.Text = ""
Text7.Text = ""
End If


End Sub

Private Sub Command6_Click()
Unload Form5

End Sub

Private Sub Form_Load()
Dim t As Integer
Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
 db.ConnectionString = "driver={SQL Server};server=ZHANWEN\ZHANWEN;database=酒店管理;User ID=sa;pwd="

 db.Open


rs.Open "select DISTINCT 房间类型 from 增删房间", db, adOpenStatic, adLockReadOnly

 Dim i As String
  For t = 0 To Val(rs.RecordCount) - 1
  i = Trim(rs.Fields("房间类型").Value)
   rs.MoveNext
   
  Combo6.AddItem i
 Next t
rs.Close
End Sub


Public Sub zengjia()

End Sub

⌨️ 快捷键说明

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