📄 frm查询客房信息.frm
字号:
Caption = "是否有空调"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column07
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 Column08
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 Column09
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 Column10
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 Column11
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 Column12
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
ColumnWidth = 824.882
EndProperty
BeginProperty Column01
ColumnWidth = 824.882
EndProperty
BeginProperty Column02
ColumnWidth = 840.189
EndProperty
BeginProperty Column03
ColumnWidth = 840.189
EndProperty
BeginProperty Column04
ColumnWidth = 854.929
EndProperty
BeginProperty Column05
ColumnWidth = 824.882
EndProperty
BeginProperty Column06
ColumnWidth = 975.118
EndProperty
BeginProperty Column07
ColumnWidth = 975.118
EndProperty
BeginProperty Column08
ColumnWidth = 975.118
EndProperty
BeginProperty Column09
ColumnWidth = 1140.095
EndProperty
BeginProperty Column10
ColumnWidth = 975.118
EndProperty
BeginProperty Column11
ColumnWidth = 810.142
EndProperty
BeginProperty Column12
ColumnWidth = 1665.071
EndProperty
EndProperty
End
End
End
End
Attribute VB_Name = "frm查询客房信息"
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 Command1_Click()
Dim i As Integer
i = MsgBox("是否确认退出?", vbYesNo, "提示")
If i = vbYes Then
Unload Me
End If
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
List3.AddItem (rs.Fields(1))
rs.MoveNext
Wend
rs.Close
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
List4.AddItem c(j)
Next j
End Sub
Private Sub List1_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open Adodc1.ConnectionString
If List1.Text = List1.List(0) Then
rs.Open "select * from 客房信息表 ", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End If
If List1.Text = List1.List(1) Then
rs.Open "select * from 客房信息表 where 房间状态 ='空房 '", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End If
If List1.Text = List1.List(2) Then
rs.Open "select * from 客房信息表 where 房间状态 = '入住 '", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End If
If List1.Text = List1.List(3) Then
rs.Open "select * from 客房信息表 where 是否被预定 = '是'", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End If
End Sub
Private Sub List2_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open Adodc1.ConnectionString
rs.Open "select * from 客房信息表 where 客房位置 = '" & List2.Text & "'", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End Sub
Private Sub List3_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open Adodc1.ConnectionString
rs.Open "select * from 客房信息表 where 客房标准 = '" & List3.Text & "'", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End Sub
Private Sub List4_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(List4.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 + -