⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 商品信息管理.frm

📁 基于VB+SQL Server的零食销售管理系统设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form 商品管理 
   Caption         =   "商品信息管理"
   ClientHeight    =   5445
   ClientLeft      =   4560
   ClientTop       =   2445
   ClientWidth     =   7425
   LinkTopic       =   "Form2"
   Picture         =   "商品信息管理.frx":0000
   ScaleHeight     =   5445
   ScaleWidth      =   7425
   Begin VB.CommandButton quit 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   5160
      TabIndex        =   16
      Top             =   4200
      Width           =   1095
   End
   Begin VB.Frame Frame3 
      Caption         =   "管理操作"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   5175
      Left            =   4320
      TabIndex        =   11
      Top             =   120
      Width           =   2895
      Begin VB.CommandButton upd 
         Caption         =   "更新"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   840
         TabIndex        =   15
         Top             =   1440
         Width           =   1095
      End
      Begin VB.CommandButton del 
         Caption         =   "删除"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   840
         TabIndex        =   14
         Top             =   3240
         Width           =   1095
      End
      Begin VB.CommandButton ok 
         Caption         =   "保存"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   840
         TabIndex        =   13
         Top             =   2280
         Width           =   1095
      End
      Begin VB.CommandButton add 
         Caption         =   "添加"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   840
         TabIndex        =   12
         Top             =   480
         Width           =   1095
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "商品信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3015
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   3855
      Begin VB.TextBox Text5 
         Height          =   495
         Left            =   2040
         TabIndex        =   18
         Top             =   2400
         Width           =   1695
      End
      Begin VB.TextBox Text3 
         Height          =   495
         Left            =   2040
         TabIndex        =   7
         Top             =   1680
         Width           =   1695
      End
      Begin VB.TextBox Text2 
         Height          =   495
         Left            =   2040
         TabIndex        =   6
         Top             =   1080
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   2040
         TabIndex        =   5
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label5 
         Caption         =   "库存量"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   17
         Top             =   2400
         Width           =   1455
      End
      Begin VB.Label Label3 
         Caption         =   "商品规格单位"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   240
         TabIndex        =   4
         Top             =   1800
         Width           =   1815
      End
      Begin VB.Label Label2 
         Caption         =   "商品规格"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   240
         TabIndex        =   3
         Top             =   1080
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "商品名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   240
         TabIndex        =   2
         Top             =   480
         Width           =   1335
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "查询"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1935
      Left            =   120
      TabIndex        =   0
      Top             =   3360
      Width           =   3855
      Begin VB.CommandButton search 
         Caption         =   "查找"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2160
         TabIndex        =   10
         Top             =   1080
         Width           =   975
      End
      Begin VB.TextBox Text4 
         Height          =   495
         Left            =   240
         TabIndex        =   9
         Top             =   1080
         Width           =   1575
      End
      Begin VB.Label Label4 
         Caption         =   "请输入商品名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   8
         Top             =   480
         Width           =   2175
      End
   End
End
Attribute VB_Name = "商品管理"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mycon As ADODB.Connection
Dim myres As ADODB.Recordset
Dim myres1 As ADODB.Recordset
Private Sub add_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text5.Text = ""
add.Enabled = False
del.Enabled = False
ok.Enabled = True
upd.Enabled = False
ok.Caption = "添加保存"
End Sub

Private Sub del_Click()
mycon.Execute "delete from 商品信息 where 商品名称='" & Text1.Text & "'"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text5.Text = ""
MsgBox "删除成功!", vbOKOnly + vbInformation, "提示"
del.Enabled = False
ok.Enabled = True
End Sub
Private Sub Form_Load()
Set mycon = New ADODB.Connection
mycon.Open "dsn=my", "sa"
Set myres = New ADODB.Recordset
myres.Open "select  * from 商品信息", mycon, adOpenDynamic, adLockOptimistic
End Sub


Private Sub ok_Click()
  If ok.Caption = "添加保存" Then
  mycon.Execute "insert 商品信息 values ('" & Text1.Text & "' ,'" & Text2.Text & "','" & Text3.Text & "')"
  MsgBox "添加成功!", vbOKOnly + vbInformation, "提示"
End If
If ok.Caption = "更新保存" Then
mycon.Execute "update 商品信息 set 商品规格='" & Text2.Text & "' ,商品规格单位='" & Text3.Text & "'where 商品名称='" & Text1.Text & "'"
MsgBox "更新成功!", vbOKOnly + vbInformation, "提示"
End If
add.Enabled = True
del.Enabled = True
ok.Enabled = False
upd.Enabled = True
ok.Caption = "保存"
End Sub

'Private Sub pre_Click()
'myres.MovePrevious
 ' If Not myres.BOF Then
  '  Text1.Text = myres.Fields(0)
   ' Text2.Text = myres.Fields(1)
   ' Text3.Text = myres.Fields(2)
 ' Else
  '  myres.MoveFirst
   ' MsgBox "该记录为第一条!", vbOKOnly + vbInformation, "提示"
 ' End If

'End Sub

Private Sub quit_Click()

Unload Me
      系统主页.Show
mycon.Close
Set mycon = Nothing
End Sub

Private Sub search_Click()
Set myres1 = New ADODB.Recordset
myres1.Open "select * from 商品信息 where 商品名称 ='" & Text4.Text & " '", mycon, adOpenDynamic, adLockOptimistic
If myres1.BOF And myres1.EOF Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text5.Text = ""
MsgBox "没有满足条件的记录!", vbOKOnly + vbInformation, "提示"
Else
Text1.Text = myres1.Fields(0)
Text2.Text = myres1.Fields(1)
Text3.Text = myres1.Fields(2)
Text5.Text = myres1.Fields(3)
End If
End Sub

Private Sub upd_Click()
Text2.Text = ""
Text3.Text = ""
add.Enabled = True
del.Enabled = False
upd.Enabled = False
ok.Caption = "更新保存"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -