📄 frmaddgoodclass.frm
字号:
VERSION 5.00
Begin VB.Form FrmAddGoodClass
BorderStyle = 3 'Fixed Dialog
Caption = "商品类别信息添加"
ClientHeight = 3060
ClientLeft = 45
ClientTop = 330
ClientWidth = 4245
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3060
ScaleWidth = 4245
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Caption = "商品类别添加"
Height = 2775
Left = 120
TabIndex = 0
Top = 120
Width = 3975
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 600
TabIndex = 3
Top = 1680
Width = 855
End
Begin VB.TextBox txtGoodClassName
Height = 270
Left = 600
TabIndex = 2
Top = 1080
Width = 2295
End
Begin VB.Label Label1
Caption = "请输入商品类别名称:"
Height = 375
Left = 600
TabIndex = 1
Top = 600
Width = 1815
End
End
End
Attribute VB_Name = "FrmAddGoodClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo errHandle:
Dim sql As String
Dim goodClassRs As ADODB.Recordset
If Me.txtGoodClassName.Text = "" Then
MsgBox "请输入商品类别信息", vbOKOnly + vbExclamation, "错误提示"
Me.txtGoodClassName.SetFocus
Exit Sub
End If
Call condatabase '连接数据库
sql = "select * from goodClass where goodClassName = '" & Me.txtGoodClassName.Text & "'"
Set goodClassRs = cn.Execute(sql) '查询数据库中是否有该商品类别信息
If Not goodClassRs.EOF Then '如果存在该商品类别
MsgBox "对不起,你输入的商品类别已经存在,请重新输入!", vbInformation, "信息提示"
Me.txtGoodClassName.Text = ""
Me.txtGoodClassName.SetFocus
Exit Sub
End If
'Download by http://www.codefans.net
sql = "insert into goodClass(goodClassName) values ('" & Me.txtGoodClassName.Text & "')"
cn.Execute (sql)
MsgBox "商品类别信息添加成功!"
Exit Sub
errHandle:
MsgBox err.Description, vbExclamation, "发生了错误!"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -