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

📄 form10.frm

📁 该程序采VB6作为前端开发工具,以SQL Server 2000作为后台数据库开发平台.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Begin VB.Label Label4 
         Caption         =   "住店时间"
         Height          =   375
         Left            =   240
         TabIndex        =   14
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "籍贯"
         Height          =   255
         Left            =   3240
         TabIndex        =   13
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "性别"
         Height          =   255
         Left            =   3240
         TabIndex        =   12
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label1 
         Caption         =   "姓名"
         Height          =   255
         Left            =   480
         TabIndex        =   11
         Top             =   360
         Width           =   495
      End
   End
   Begin VB.Frame Frame1 
      Height          =   855
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5655
      Begin VB.CommandButton Command1 
         Caption         =   "查询"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   4440
         TabIndex        =   2
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H0000FFFF&
         Height          =   375
         Left            =   2760
         TabIndex        =   1
         Top             =   360
         Width           =   1335
      End
      Begin VB.Label Label11 
         BackColor       =   &H8000000B&
         Caption         =   "请输入退房人的姓名或证件号码:"
         ForeColor       =   &H000000C0&
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   3135
      End
   End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs As ADODB.Recordset
Public db As ADODB.Connection
Private Sub Command1_Click()
Dim x As Integer
On Error Resume Next
'Set db = New ADODB.Connection
Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=04;database=酒店管理;Persist Security Info=False;User ID=sa"

db.Open
rs.Open "SELECT COUNT(姓名) AS Expr1 FROM 酒店登记 WHERE 姓名='" & Text1.Text & "'", db, adOpenDynamic, adLockReadOnly
 x = rs.Fields("Expr1").Value
'rs.Open "SELECT COUNT(姓名) AS Expr1 FROM 酒店登记 where 姓名='" & Text1.Text & "'", db, adOpenDynamic, adLockReadOnly
'x = Trim(rs.Fields("expr1").Value)
If x > 1 Then

n = MsgBox("有重名!请输入证件号码!", 48)
Text1.Text = ""
Text1.SetFocus
 Else
  'rs.Open "select DISTINCT 房间类型 from 增删房间", db, adOpenStatic, adLockReadOnly
rs.Close
rs.Open "select * from 酒店登记 where 姓名='" & Text1.Text & "' or 证件号码='" & Text1.Text & "'", db, adOpenDynamic, adLockReadOnly
If rs.EOF Then
n = MsgBox("无此人!", vbInformation)
Text1.Text = ""
Text1.SetFocus
Else
Text10.Text = rs.Fields("姓名").Value
Text2.Text = rs.Fields("性别").Value
Text3.Text = rs.Fields("住店时间").Value
Text4.Text = rs.Fields("籍贯").Value
Text5.Text = rs.Fields("房间类型").Value
Text12.Text = rs.Fields("证件名称").Value
Text11.Text = rs.Fields("房间号码").Value
Text13.Text = rs.Fields("证件号码").Value
 Set DataGrid1.DataSource = rs
 rs.Close
 
 Dim m As Integer
Dim y As Integer
Dim j As Date
i = Text3.Text
j = Date
m = DateDiff("d", i, j)
Text7.Text = m
 
rs.Open "select DISTINCT 收费标准 from 增删房间 where 房间类型='" & Text5.Text & "'", db, adOpenDynamic, adLockReadOnly
Text8.Text = rs.Fields("收费标准").Value
'rs.Close
'rs.Open "select * from 酒店登记 where 姓名='" & Text1.Text & "' or 证件号码='" & Text1.Text & "'", db, adOpenStatic, adLockReadOnly
    ' Set DataGrid1.DataSource = rs
End If

End If
End Sub

Private Sub Command2_Click()
On Error Resume Next
Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
 db.ConnectionString = "driver={SQL Server};server=04;database=酒店管理;Persist Security Info=False;User ID=sa"

db.Open






If Text10.Text = "" Then
 h = MsgBox("没有人", 48)
 Else
If Text6.Text = "" Then
 h = MsgBox("住宿人数没填", 48)
 Text6.SetFocus
 Else
 If Text6.Text < 0 Then
  h = MsgBox("住宿人填错,请重填!", 48)
  Text6.Text = ""
  Text6.SetFocus
  Else
If Command2.Caption = "结帐" Then
  Command2.Caption = "确定"
x = Text7.Text
k = Text6.Text
l = Text8.Text
y = x * k * l
Text9.Text = y
Else
Command2.Caption = "结帐"

rs.Open " insert into 退房情况(住店时间,姓名,性别,退房时间,住宿天数,住宿人数,籍贯,证件名称,证件号码,房间类型,房间号码,总金额) values ( '" & Trim(Text3.Text) & "','" & Trim(Text10.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Date) & "','" & Trim(Text7.Text) & "','" & Trim(Text6.Text) & "','" & Trim(Text4.Text) & "','" & Trim(Text12.Text) & "','" & Trim(Text13.Text) & "','" & Trim(Text5.Text) & "','" & Trim(Text11.Text) & "','" & Trim(Text9.Text) & "')", db, adOpenStatic, adLockReadOnly

'rs.Open " insert into 退房情况(姓名,性别,住店时间,退房时间,住宿天数,籍贯,房间类型,房间号码,证件名称,总金额,住宿人数) values ( '" & Text10.Text & "','" & Trim(Text2.Text) & "','" & Trim(Text3.Text) & "','" & Trim(Date) & "','" & Trim(Text7.Text) & "','" & Trim(Text4.Text) & "','" & Trim(Text5.Text) & "','" & Trim(Text11.Text) & "','" & Trim(Text12.Text) & "','" & Trim(Val(Text9.Text)) & "','" & Trim(Val(Text6.Text)) & "')", db, adOpenDynamic, adLockReadOnly
'rs.Close
rs.Open "delete from 酒店登记 where 姓名='" & Text1.Text & "' or 证件号码='" & Text1.Text & "'", db, adOpenDynamic, adLockReadOnly
 'Set DataGrid1.DataSource = rs
Text1.Text = ""
Text10.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text1.SetFocus
Command2.Enabled = False
End If
End If
End If
End If
End Sub

Private Sub Command3_Click()
Form10.Hide
form1.Show
Text1.Text = ""
Text10.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
If Command3.Enabled = True Then

Command2.Caption = "结帐"
Command2.Enabled = False
End If
End Sub
Private Sub Form_Load()

Set db = New ADODB.Connection
 Set rs = New ADODB.Recordset
 db.ConnectionString = "driver={SQL Server};server=04;database=酒店管理;Persist Security Info=False;User ID=sa"

db.Open
Text1.Text = ""
Text10.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Command2.Enabled = False


End Sub

Private Sub Text1_LostFocus()
If Command2.Enabled = False Then
   Command2.Enabled = True
   End If
End Sub

⌨️ 快捷键说明

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