📄 frmadddish.frm
字号:
VERSION 5.00
Begin VB.Form frmAddDish
BorderStyle = 1 'Fixed Single
Caption = "添加菜肴信息"
ClientHeight = 3630
ClientLeft = 45
ClientTop = 330
ClientWidth = 7410
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3630
ScaleWidth = 7410
StartUpPosition = 3 '窗口缺省
Begin VB.OptionButton OpN
Caption = "否"
Height = 255
Left = 6120
TabIndex = 12
Top = 1080
Width = 615
End
Begin VB.OptionButton OpY
Caption = "是"
Height = 255
Left = 5040
TabIndex = 11
Top = 1080
Value = -1 'True
Width = 615
End
Begin VB.CommandButton cancelCommand
Caption = "关闭退出"
Height = 492
Left = 4320
TabIndex = 10
Top = 2880
Width = 1215
End
Begin VB.CommandButton updateCommand
Caption = "保存记录"
Height = 492
Left = 2040
TabIndex = 9
Top = 2880
Width = 1095
End
Begin VB.TextBox txtNO
Height = 372
Left = 960
TabIndex = 3
Top = 360
Width = 2295
End
Begin VB.TextBox txtDishName
Height = 372
Left = 4800
TabIndex = 2
Top = 360
Width = 2295
End
Begin VB.TextBox txtPrice
Height = 372
Left = 960
TabIndex = 1
Top = 960
Width = 2295
End
Begin VB.TextBox txtComment
Height = 1095
Left = 960
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 1560
Width = 6225
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "编号:"
Height = 180
Left = 240
TabIndex = 8
Top = 360
Width = 555
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "名称:"
Height = 180
Left = 3840
TabIndex = 7
Top = 480
Width = 555
End
Begin VB.Label Label4
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "是否可用:"
Height = 180
Left = 3720
TabIndex = 6
Top = 1080
Width = 900
End
Begin VB.Label Label5
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "价格:"
Height = 180
Left = 240
TabIndex = 5
Top = 960
Width = 555
End
Begin VB.Label Label9
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "备注:"
Height = 180
Left = 240
TabIndex = 4
Top = 1680
Width = 555
End
End
Attribute VB_Name = "frmAddDish"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cancelCommand_Click()
Unload Me
End Sub
Private Sub updateCommand_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrcc As ADODB.Recordset
If Not Testtxt(txtNO.Text) Then
MsgBox "请输入菜肴编号!", vbOKOnly + vbExclamation, "警告"
txtNO.SetFocus
Exit Sub
End If
If Not Testtxt(txtDishName.Text) Then
MsgBox "请输入菜肴名称!", vbOKOnly + vbExclamation, "警告"
txtDishName.SetFocus
Exit Sub
End If
If Not IsNumeric(txtPrice.Text) Then
MsgBox "请输入菜肴价格!", vbOKOnly + vbExclamation, "警告"
txtPrice.SetFocus
Exit Sub
End If
txtSQL = "select * from 菜肴信息 where 名称 = '" & Trim(txtDishName.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "菜肴编号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtNO.SetFocus
Else
mrcc.AddNew
'添加新的记录
mrcc.Fields(0) = Trim(txtDishName.Text)
mrcc.Fields(1) = Trim(txtPrice.Text)
If OpY.Value = True Then
mrcc.Fields(2) = 1
Else
mrcc.Fields(2) = 0
End If
mrcc.Fields(3) = Trim(txtComment.Text)
mrcc.Update
MsgBox "菜肴信息添加成功!", vbOKOnly + vbExclamation, "添加菜肴信息"
mrcc.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -