📄 frmjdxx.frm
字号:
VERSION 5.00
Begin VB.Form Frmjdxx
BorderStyle = 3 'Fixed Dialog
Caption = "酒店信息初始化"
ClientHeight = 2625
ClientLeft = 45
ClientTop = 435
ClientWidth = 5880
Icon = "Frmjdxx.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2625
ScaleWidth = 5880
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
Caption = "添加(&A)"
Height = 375
Left = 840
TabIndex = 7
Top = 2160
Width = 4695
End
Begin VB.TextBox Text1
DataField = "酒店名"
Height = 375
Index = 2
Left = 960
MaxLength = 15
TabIndex = 3
Top = 1560
Width = 4575
End
Begin VB.TextBox Text1
DataField = "酒店名"
Height = 375
Index = 1
Left = 960
MaxLength = 15
TabIndex = 2
Top = 840
Width = 4575
End
Begin VB.CommandButton Command1
Caption = "确定修改(&U)"
Height = 375
Left = 840
TabIndex = 1
Top = 2160
Width = 4695
End
Begin VB.TextBox Text1
DataField = "酒店名"
Height = 375
Index = 0
Left = 960
MaxLength = 10
TabIndex = 0
Top = 120
Width = 4575
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "酒店电话"
Height = 180
Index = 2
Left = 120
TabIndex = 6
Top = 1680
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "酒店地址"
Height = 180
Index = 1
Left = 120
TabIndex = 5
Top = 960
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "酒店名"
Height = 180
Index = 0
Left = 240
TabIndex = 4
Top = 240
Width = 540
End
End
Attribute VB_Name = "Frmjdxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Private Sub Command1_Click()
For i = 0 To 2
If Text1(i) = "" Then
MsgBox "所填项目不能为空", vbOKOnly + vbInformation, "提示"
Text1(j).SetFocus
GoTo aa
End If
Next
For j = 0 To 2
rs1.Update rs1.Fields(j).Name, Text1(j)
rs1.Update
Next
MsgBox "修改成功!", vbOKOnly + vbInformation, "恭喜"
frmmain.Caption = Trim(rs1.Fields("酒店名")) & " - 餐饮管理系统"
Unload Me
aa:
End Sub
Private Sub Command2_Click()
For i = 0 To 2
If Text1(i) = "" Then
MsgBox "所填项目不能为空", vbOKOnly + vbInformation, "提示"
Text1(j).SetFocus
GoTo aa
End If
Next
rs1.AddNew
For j = 0 To 2
rs1.Fields(j) = Text1(j)
Next
rs1.Update
MsgBox "添加成功!", vbOKOnly + vbInformation, "恭喜"
frmmain.Caption = Trim(rs1.Fields("酒店名")) & " - 餐饮管理系统"
Unload Me
aa:
End Sub
Private Sub form_Load()
If rs1.State Then rs1.Close
rs1.Open "select * from 酒店信息", conn, adOpenKeyset, adLockPessimistic
If rs1.EOF And rs1.BOF Then
Command1.Visible = False
Else
Command2.Visible = False
For i = 0 To 2
Text1(i).Text = Trim(rs1.Fields(i))
Next
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If rs1.State Then rs1.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -