?? 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
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 + -