📄 frmmain.frm
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmMain
Caption = "选择房间"
ClientHeight = 3630
ClientLeft = 60
ClientTop = 450
ClientWidth = 3675
LinkTopic = "Form1"
ScaleHeight = 3630
ScaleWidth = 3675
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox lblstat
Height = 375
Left = 1200
TabIndex = 4
Text = "Text1"
Top = 2280
Width = 2175
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 495
Left = 2040
TabIndex = 3
Top = 2880
Width = 1335
End
Begin VB.CommandButton cmdreg
Caption = "登记"
Height = 495
Left = 360
TabIndex = 2
Top = 2880
Width = 1335
End
Begin MSDataListLib.DataList Dataroom
Height = 1530
Left = 1200
TabIndex = 1
Top = 600
Width = 2175
_ExtentX = 3836
_ExtentY = 2699
_Version = 393216
End
Begin MSDataListLib.DataCombo datatype
Height = 330
Left = 1200
TabIndex = 0
Top = 120
Width = 2175
_ExtentX = 3836
_ExtentY = 582
_Version = 393216
Text = "DataCombo1"
End
Begin VB.Label Label2
Caption = "空余房间号:"
Height = 255
Left = 120
TabIndex = 6
Top = 600
Width = 1095
End
Begin VB.Label Label1
Caption = "房间类型:"
Height = 255
Left = 240
TabIndex = 5
Top = 120
Width = 855
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rsroomtype As ADODB.Recordset
Dim rsroom As ADODB.Recordset
Dim str As String
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Cmdreg_Click()
If Dataroom.Text = "" Then
MsgBox "请选择房间", vbOKOnly + vbInformation, "提示"
Exit Sub
End If
reg = 1
FrmReg.Show 1
End Sub
Private Sub datatype_Change()
Set cnn = New ADODB.Connection
Dim connectstring As String
connectstring = "DSN=hotelodbc"
cnn.Open connectstring
str = "select * from room,roomstate where roomstate.roomstate ='r' and room.roomcode=roomstate.roomcode and typeno='" & datatype.BoundText & "'"
Set rsroom = New ADODB.Recordset
rsroom.Open str, cnn, adOpenKeyset, adLockOptimistic
Set Dataroom.RowSource = rsroom
Dataroom.ListField = "roomcode"
Dataroom.BoundColumn = "roomcode"
lblstat.Text = "剩余房间数量:" & rsroom.RecordCount
End Sub
Private Sub Form_Load()
Set cnn = New ADODB.Connection
Dim connectstring As String
connectstring = "DSN=hotelodbc"
cnn.Open connectstring
Set rsroomtype = New ADODB.Recordset
str = "select * from roomtype "
rsroomtype.Open str, cnn, adOpenKeyset, adLockOptimistic
Set datatype.RowSource = rsroomtype
datatype.ListField = "typename"
datatype.BoundColumn = "typeno"
rsroomtype.MoveFirst
datatype.Text = rsroomtype.Fields("typename")
End Sub
Private Sub Form_Unload(Cancel As Integer)
rsroom.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -