📄 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 frm查询住宿信息
Caption = "查询住宿信息"
ClientHeight = 6855
ClientLeft = 60
ClientTop = 465
ClientWidth = 10080
Icon = "frm查询住宿信息.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6855
ScaleWidth = 10080
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
BackColor = &H80000013&
Height = 6855
Left = 0
ScaleHeight = 6795
ScaleWidth = 10035
TabIndex = 0
Top = 0
Width = 10095
Begin VB.PictureBox Picture7
BackColor = &H80000013&
Height = 1935
Left = 240
ScaleHeight = 1875
ScaleWidth = 1755
TabIndex = 12
Top = 4320
Width = 1815
Begin VB.Frame Frame3
BackColor = &H80000013&
Caption = "客房标准"
Height = 1815
Left = 120
TabIndex = 13
Top = 0
Width = 1575
Begin VB.ListBox List3
Height = 1500
ItemData = "frm查询住宿信息.frx":06EA
Left = 120
List = "frm查询住宿信息.frx":06F1
TabIndex = 14
Top = 240
Width = 1335
End
End
End
Begin VB.PictureBox Picture4
BackColor = &H80000013&
Height = 2055
Left = 240
ScaleHeight = 1995
ScaleWidth = 1755
TabIndex = 7
Top = 2280
Width = 1815
Begin VB.PictureBox Picture6
Height = 15
Left = 0
ScaleHeight = 15
ScaleWidth = 735
TabIndex = 11
Top = 2040
Width = 735
End
Begin VB.PictureBox Picture5
Height = 15
Left = 0
ScaleHeight = 15
ScaleWidth = 615
TabIndex = 10
Top = 2040
Width = 615
End
Begin VB.Frame Frame2
BackColor = &H80000013&
Caption = "客房位置"
Height = 1935
Left = 120
TabIndex = 8
Top = 0
Width = 1575
Begin VB.ListBox List2
Height = 1500
ItemData = "frm查询住宿信息.frx":06FB
Left = 120
List = "frm查询住宿信息.frx":0714
TabIndex = 9
Top = 240
Width = 1335
End
End
End
Begin VB.PictureBox Picture3
BackColor = &H80000013&
Height = 1935
Left = 240
ScaleHeight = 1875
ScaleWidth = 1755
TabIndex = 4
Top = 360
Width = 1815
Begin VB.Frame Frame1
BackColor = &H80000013&
Caption = "客房编号"
Height = 1815
Left = 120
TabIndex = 5
Top = 0
Width = 1575
Begin VB.ListBox List1
Height = 1500
ItemData = "frm查询住宿信息.frx":0742
Left = 120
List = "frm查询住宿信息.frx":0749
TabIndex = 6
Top = 240
Width = 1335
End
End
End
Begin VB.PictureBox Picture2
BackColor = &H80000013&
Height = 5415
Left = 2040
ScaleHeight = 5355
ScaleWidth = 7875
TabIndex = 2
Top = 360
Width = 7935
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frm查询住宿信息.frx":0753
Height = 5175
Left = 120
TabIndex = 3
Top = 120
Width = 7695
_ExtentX = 13573
_ExtentY = 9128
_Version = 393216
BackColor = 65280
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
Caption = "住宿信息表"
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
End
Begin VB.CommandButton Command1
Default = -1 'True
Height = 495
Left = 5880
Picture = "frm查询住宿信息.frx":0768
Style = 1 'Graphical
TabIndex = 1
ToolTipText = "关闭窗口"
Top = 5880
Width = 495
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 7320
Top = 0
Visible = 0 'False
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 顾客登记表"
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
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
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)
If List1.Text = "所有" Then
rs.Open "select * from 顾客登记表", cn, 1, 3
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
Else
rs.Open "select * from 顾客登记表 where 客房编号='" & c(n) & "'", cn, 1, 3
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
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
If List2.Text = List2.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
Else
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 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
If List3.Text = List3.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
Else
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 If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -