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

📄 form1.frm

📁 可以完成宾馆的日常管理功能,例如订房,登记,入住,结帐,和打印报表等
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4695
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7860
   LinkTopic       =   "Form1"
   ScaleHeight     =   4695
   ScaleWidth      =   7860
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   255
      Left            =   2040
      TabIndex        =   2
      Top             =   2640
      Width           =   1215
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   3720
      Top             =   2640
      Width           =   1695
      _ExtentX        =   2990
      _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=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=wmtao"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "wmtao"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from 客房信息表 where 房间状态 ='空房'or 房间状态 = '入住' or 是否被预定 = '是'"
      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
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "Form1.frx":0000
      Height          =   2175
      Left            =   1800
      TabIndex        =   1
      Top             =   360
      Width           =   6015
      _ExtentX        =   10610
      _ExtentY        =   3836
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.ListBox List1 
      Height          =   2400
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub birsearch(a() As Integer, ByVal low As Integer, ByVal high As Integer, ByVal key, index As Integer)
Dim mid As Integer
    mid = (low + high) \ 2
    If a(mid) = key Then
        index = mid
        Exit Sub
    ElseIf low > high Then
        index = -1
        Exit Sub
    End If
If key < a(mid) Then
    high = mid - 1
Else
    low = mid + 1
End If
    Call birsearch(a, low, high, key, index)
End Sub


Private Sub Form_Load()
Dim s As Integer
Dim t As Integer
Dim r As Integer
Dim j As Integer
Dim k As Integer
Dim q As String
r = 0
t = 0
k = 0
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
cn.Open frm登录.Adodc1.ConnectionString

rs.Open "select * from 客房信息表  ", cn, 1, 3
 While Not rs.EOF
    r = r + 1
 rs.MoveNext
 Wend
 ReDim c(r) As Integer
 rs1.Open "select * from 客房信息表 ", cn, 1, 3
 While Not rs1.EOF
   c(t) = rs1.Fields("客房编号")
   t = t + 1
 rs1.MoveNext
 Wend
 For j = 0 To t - 2
    s = j
    For k = j + 1 To t - 1
            If c(s) > c(k) Then s = k
    Next k
      q = c(j)
      c(j) = c(s)
      c(s) = q
 Next j
For j = 0 To t - 1
  List1.AddItem c(j)
  Next j

End Sub

Private Sub List1_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
cn.Open frm登录.Adodc1.ConnectionString
Dim t As Integer
Dim r As Integer
Dim n As Integer
rs.Open "select * from 客房信息表  ", cn, 1, 3
 While Not rs.EOF
    r = r + 1
 rs.MoveNext
 Wend
 rs.Close
 ReDim c(r) As Integer
 rs1.Open "select * from 客房信息表 order by 客房编号 asc", cn, 1, 3
 While Not rs1.EOF
   c(t) = Val(rs1.Fields("客房编号"))
   t = t + 1
 rs1.MoveNext
 Wend
 Call birsearch(c, LBound(c), UBound(c), Val(List1.Text), n)

 rs.Open "select * from 客房信息表 where 客房编号='" & c(n) & "'", cn, 1, 3
 Set DataGrid1.DataSource = rs
 DataGrid1.Refresh
End Sub

⌨️ 快捷键说明

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