📄 frmselroom.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"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmSelRoom
Caption = "查询空余客房"
ClientHeight = 4935
ClientLeft = 60
ClientTop = 465
ClientWidth = 4830
Icon = "frmSelRoom.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4935
ScaleWidth = 4830
Visible = 0 'False
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 1200
Top = 3360
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=KFGL;Data Source=5c92669bd5be43c"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=KFGL;Data Source=5c92669bd5be43c"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "dbo.tblRoomType"
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 MSDataListLib.DataCombo DataCombo1
Bindings = "frmSelRoom.frx":C84A
Height = 330
Left = 600
TabIndex = 6
Top = 720
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
ListField = "rName"
Text = "客房类型"
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 855
Left = 600
TabIndex = 5
Top = 2280
Width = 3255
_ExtentX = 5741
_ExtentY = 1508
_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.TextBox Text1
Height = 375
Left = 2400
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 3000
TabIndex = 1
TabStop = 0 'False
Top = 720
Width = 735
End
Begin VB.Label Label3
Caption = "现余空房:"
Height = 255
Left = 600
TabIndex = 4
Top = 1800
Width = 1335
End
Begin VB.Label Label2
Caption = "该类型客房价格:"
Height = 255
Left = 600
TabIndex = 2
Top = 1320
Width = 1455
End
Begin VB.Label Label1
Caption = "请选择需要的房间类型,查询空余客房。"
Height = 255
Left = 600
TabIndex = 0
Top = 240
Width = 3375
End
End
Attribute VB_Name = "frmSelRoom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As New ADODB.Connection
Private Sub Command1_Click()
Dim rprice As Currency
Dim strRoomType As String
Dim cmm As New ADODB.Command
Dim rs As ADODB.Recordset
Dim strCnn As String
strCnn = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Password=052606241;Initial Catalog=KFGL;Data Source=5c92669bd5be43c"
If cnn.State Then
cnn.Close
End If
cnn.Open strCnn
cnn.CursorLocation = adUseClient
If Not Adodc1.Recordset.EOF Then
strRoomType = Adodc1.Recordset.Fields("rType").Value
End If
cmm.CommandText = "SelRoom"
cmm.CommandType = adCmdStoredProc
Set cmm.ActiveConnection = cnn
cmm.Parameters.Append cmm.CreateParameter("RoomType", adVarChar, adParamInput, 2, strRoomType)
cmm.Parameters.Append cmm.CreateParameter("RoomPrice", adCurrency, adParamOutput)
Set rs = cmm.Execute
rprice = cmm.Parameters(1).Value
Text1.Text = Str$(rprice)
Label3.Caption = "现余空房:" & Str$(rs.RecordCount) & "间"
DataGrid1.ClearFields
Set DataGrid1.DataSource = rs
DataGrid1.Columns(0).Caption = "空客房号"
End Sub
Private Sub DataCombo1_Change()
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("rName='" & DataCombo1.Text & "'")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -