📄 form19.frm
字号:
VERSION 5.00
Begin VB.Form Form19
BorderStyle = 4 'Fixed ToolWindow
Caption = "房间类型维护"
ClientHeight = 3540
ClientLeft = 45
ClientTop = 315
ClientWidth = 6510
LinkTopic = "Form19"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3540
ScaleWidth = 6510
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame2
Caption = "删除操作"
Height = 615
Left = 1920
TabIndex = 5
Top = 120
Width = 4455
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "在左侧的列表中双击选定的房间类型进行删除操作!"
Height = 975
Left = 0
TabIndex = 6
Top = 240
Width = 4455
End
End
Begin VB.ListBox List1
Height = 3120
Left = 120
TabIndex = 4
Top = 120
Width = 1455
End
Begin VB.Frame Frame1
Caption = "请输入要添加的类型"
Height = 855
Left = 2640
TabIndex = 3
Top = 1080
Width = 2895
Begin VB.TextBox Text1
Height = 495
Left = 240
TabIndex = 0
Top = 240
Width = 2535
End
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 4560
TabIndex = 2
Top = 2400
Width = 975
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 2760
TabIndex = 1
Top = 2400
Width = 1215
End
Begin VB.Line Line1
X1 = 1680
X2 = 1680
Y1 = 0
Y2 = 3600
End
End
Attribute VB_Name = "Form19"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'FIXIT: 使用 Option Explicit 可以避免隐式创建 Variant 类型的变量 FixIT90210ae-R383-H1984
Dim Yume As String
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
MsgBox "对不起,类型必须输入? ", vbInformation, "Hello!"
Text1.SetFocus
Exit Sub
End If
'开始保存内容
Dim db As Database
Dim EF As Recordset
Set db = OpenDatabase(ConData, False, False, Constr)
Set EF = db.OpenRecordset("Select * from kflx", dbOpenDynaset)
'==================1
'FIXIT: 用 "Trim$" 函数替换 "Trim" 函数 FixIT90210ae-R9757-R1B8ZE
If Trim(Text1.Text) <> "" Then
EF.AddNew
EF("客房类型") = Text1.Text
EF.Update
End If
'-----------------2
'-----------------
EF.Close
db.Close
Yume = "Select * from kflx"
List1.Clear
SearchIt
MsgBox "类型已经录入 ", vbInformation
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Yume = "Select * from kflx"
SearchIt
End Sub
Private Sub SearchIt()
'检索数据
Dim db As Database
Dim EF As Recordset
Set db = OpenDatabase(ConData, False, False, Constr)
Set EF = db.OpenRecordset(Yume, dbOpenDynaset)
'列出记录
If Not (EF.BOF And EF.EOF) Then
Do While Not EF.EOF
List1.AddItem EF("客房类型")
EF.MoveNext
Loop
End If
'添加合计
EF.Close
db.Close
End Sub
Private Sub List1_DblClick()
Yume = "Select * from kflx where 客房类型='" & List1.Text & "'"
If MsgBox("您确认要删除本条记录吗(Y/N)? ", vbInformation + vbYesNo) = vbYes Then dIt
End Sub
Private Sub dIt()
'检索数据
Dim db As Database
Dim EF As Recordset
Set db = OpenDatabase(ConData, False, False, Constr)
Set EF = db.OpenRecordset(Yume, dbOpenDynaset)
'列出记录
If Not (EF.BOF And EF.EOF) Then
Do While Not EF.EOF
EF.Delete
EF.MoveNext
Loop
End If
'添加合计
EF.Close
db.Close
List1.Clear
Yume = "Select * from kflx"
SearchIt
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -