📄 frmgoodclassmanage.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmGoodClassManage
BorderStyle = 3 'Fixed Dialog
Caption = "商品类别信息管理"
ClientHeight = 4365
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4365
ScaleWidth = 4680
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "删除类别"
Height = 375
Left = 2520
TabIndex = 4
Top = 3480
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "修改类别信息"
Height = 375
Left = 840
TabIndex = 3
Top = 3480
Width = 1455
End
Begin VB.TextBox txtGoodClassName
DataField = "商品类别名称"
DataSource = "Adodc1"
Height = 375
Left = 1800
TabIndex = 2
Top = 2880
Width = 1575
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "FrmGoodClassManage.frx":0000
Height = 2655
Left = 120
TabIndex = 0
Top = 120
Width = 4455
_ExtentX = 7858
_ExtentY = 4683
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1320
Top = 3960
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=StockDB"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "StockDB"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select goodClassId as 商品类别编号,goodClassName as 商品类别名称 from goodClass"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label1
Caption = "商品名称"
Height = 255
Left = 600
TabIndex = 1
Top = 3000
Width = 975
End
End
Attribute VB_Name = "FrmGoodClassManage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Download by http://www.codefans.net
Private Sub Command1_Click()
With Me.Adodc1.Recordset
.Fields(1).Value = Me.txtGoodClassName.Text
.Update
End With
MsgBox "商品类别信息更新成功!"
End Sub
Private Sub Command2_Click()
Dim result As VbMsgBoxResult
Dim goodClassId As Integer '要删除的商品类别编号
Dim goodCount As Integer
Dim sql As String
Dim goodInfoCountRs As ADODB.Recordset
If Me.Adodc1.Recordset.EOF And Me.Adodc1.Recordset.BOF Then
MsgBox "对不起,不存在商品类别信息,不能删除!"
Exit Sub
End If
result = MsgBox("确认删除当前的商品类别信息吗?", vbOKCancel, "删除确认")
If result = vbOK Then
goodClassId = Me.Adodc1.Recordset.Fields(0).Value '取得要删除的商品类别编号
sql = "select count(*) as goodCount from goodInfo where goodClassId = " & goodClassId
Set goodInfoCountRs = cn.Execute(sql) '查询商品信息数据库中是否还有该商品类别的商品
goodCount = goodInfoCountRs(0) '取得该商品类别的商品数量
If goodCount > 0 Then '如果还存在商品是不允许进行该商品类别的删除的
MsgBox "对不起,请删除该类别下的所有商品后再执行本操作", vbInformation, "信息提示"
Exit Sub
End If
Me.Adodc1.Recordset.Delete
MsgBox "商品类别信息删除成功!"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -