📄 product.frm
字号:
VERSION 5.00
Begin VB.Form product
BorderStyle = 1 'Fixed Single
Caption = "产品资料编辑"
ClientHeight = 2925
ClientLeft = 45
ClientTop = 375
ClientWidth = 7845
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "product.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2925
ScaleWidth = 7845
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 360
Left = 2160
TabIndex = 0
Text = "Text1"
Top = 360
Width = 1095
End
Begin VB.TextBox Text2
Height = 375
Left = 2160
TabIndex = 1
Text = "Text2"
Top = 840
Width = 4815
End
Begin VB.TextBox Text3
Height = 375
Left = 2160
TabIndex = 2
Text = "Text3"
Top = 1320
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "查找"
Height = 495
Left = 1320
TabIndex = 3
Top = 2040
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "保存"
Height = 495
Left = 3360
TabIndex = 4
Top = 2040
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "修改"
Height = 495
Left = 5235
TabIndex = 5
Top = 2040
Width = 1215
End
Begin VB.Label Label1
Caption = "产品编号:"
Height = 255
Left = 720
TabIndex = 8
Top = 360
Width = 1215
End
Begin VB.Label Label2
Caption = "产品名称:"
Height = 255
Left = 720
TabIndex = 7
Top = 840
Width = 1455
End
Begin VB.Label Label4
Caption = "产品价格:"
Height = 255
Left = 720
TabIndex = 6
Top = 1320
Width = 1335
End
End
Attribute VB_Name = "product"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim reslut As New ADODB.Recordset
If Text1.Text = "" Then
MsgBox "产品编号不能为空,请检查!", vbOKOnly + vbInformation, "互联网出版发行中心发行系统!"
Exit Sub
End If
reslut.Open "select * from 产品目录 where 产品编号='" & Text1.Text & "'", main.strcnn, adOpenKeyset, adLockOptimistic
If Not reslut.EOF Then
If IsNull(reslut.Fields("产品名称")) = False Then
Text2.Text = reslut.Fields("产品名称")
End If
If IsNull(reslut.Fields("价格")) = False Then
Text3.Text = reslut.Fields("价格")
End If
Command3.Enabled = False
Text1.Enabled = False
Else
MsgBox "查询的编号不存在,请检查!", vbOKOnly + vbInformation, "互联网出版发行中心发行系统!"
Text1.Text = ""
Text1.SetFocus
End If
reslut.Close
End Sub
Private Sub Command3_Click()
Dim reslut As New ADODB.Recordset
Dim i
i = MsgBox("确定输入该产品资料?", vbYesNo + vbInformation, "互联网出版发行中心发行系统!")
If i = vbYes Then
reslut.Open "select * from 产品目录 where 产品编号='" & Text1.Text & "'", main.strcnn, adOpenKeyset, adLockOptimistic
If reslut.EOF Then
reslut.AddNew
reslut.Fields("产品编号") = Text1.Text
reslut.Fields("产品名称") = Text2.Text
reslut.Fields("价格") = Text3.Text
reslut.Update
MsgBox "信息保存完成!", vbOKOnly + vbInformation, "互联网出版发行中心发行系统!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Else
MsgBox "该产品编号已经存在,请检查!", vbOKOnly + vbInformation, "互联网出版发行中心发行系统!"
Text1.Text = ""
Text1.SetFocus
End If
reslut.Close
End If
End Sub
Private Sub Command4_Click()
Dim reslut As New ADODB.Recordset
Dim i
reslut.Open "select * from 产品目录 where 产品编号='" & Text1.Text & "'", main.strcnn, adOpenKeyset, adLockOptimistic
If Not reslut.EOF Then
reslut.Fields("产品名称") = Text2.Text
reslut.Fields("价格") = Text3.Text
reslut.Update
Command3.Enabled = True
Text1.Enabled = True
MsgBox "商品资料修改完成!", vbOKOnly + vbInformation, "互联网出版发行中心发行系统!"
End If
reslut.Close
Call Form_Load
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -