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

📄 frmtype.frm

📁 管理超市
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmType 
   BackColor       =   &H00FFC0FF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "种类设置"
   ClientHeight    =   5055
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8325
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5055
   ScaleWidth      =   8325
   StartUpPosition =   2  'CenterScreen
   Begin VB.ComboBox cboName 
      Height          =   315
      Left            =   2760
      TabIndex        =   8
      Top             =   720
      Width           =   3015
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加"
      Height          =   375
      Left            =   2160
      TabIndex        =   7
      Top             =   4200
      Width           =   1095
   End
   Begin VB.CommandButton cmdDel 
      Caption         =   "删除"
      Height          =   375
      Left            =   3480
      TabIndex        =   6
      Top             =   4200
      Width           =   1095
   End
   Begin VB.CommandButton cmdModify 
      Caption         =   "修改"
      Height          =   375
      Left            =   4800
      TabIndex        =   5
      Top             =   4200
      Width           =   1095
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "关闭"
      Height          =   375
      Left            =   6120
      TabIndex        =   4
      Top             =   4200
      Width           =   1095
   End
   Begin VB.CommandButton cmdFind 
      Caption         =   "查找"
      Height          =   375
      Left            =   840
      TabIndex        =   3
      Top             =   4200
      Width           =   1095
   End
   Begin VB.TextBox txtP 
      Height          =   2295
      Left            =   2760
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   2
      Top             =   1320
      Width           =   3015
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "说明(50字)"
      Height          =   255
      Index           =   1
      Left            =   1680
      TabIndex        =   1
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "类名*"
      Height          =   255
      Index           =   0
      Left            =   1680
      TabIndex        =   0
      Top             =   720
      Width           =   615
   End
End
Attribute VB_Name = "frmType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Sql As String
Dim RS As ADODB.Recordset
Private Sub cmdAdd_Click()
'添加
If Trim(Me.cboName.Text) <> "" Then
    Sql = "select * from 种类表 where 种类名='" & Trim(Me.cboName.Text) & "'"
    Set RS = dbSelect(Sql)
    If RS.EOF Then
        Sql = "insert into 种类表 values('" & Trim(Me.cboName.Text) & "','"
        Sql = Sql & Trim(Me.txtP.Text) & "')'"
        dbOperate Sql
    Else
        MsgBox "库中已有!"
    End If
Else
    MsgBox "主键不能为空!"
End If
End Sub
Private Sub cmdDel_Click()
'删除
If Trim(Me.cboName.Text) <> "" Then
    Sql = "select * from 种类表 where 种类名='" & Trim(Me.cboName.Text) & "'"
    Set RS = dbSelect(Sql)
    If Not RS.EOF Then
        Sql = "delete from 种类表 where 种类名='" & Trim(Me.cboName.Text) & "'"
        dbOperate Sql
    Else
        MsgBox "库中无此数据!"
    End If
Else
    MsgBox "主键不能为空!"
End If
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdFind_Click()
'查找
If Trim(Me.cboName.Text) <> "" Then
    Sql = "select * from 种类表 where 种类名='" & Trim(Me.cboName.Text) & "'"
    Set RS = dbSelect(Sql)
    If Not RS.EOF Then
        Me.txtP.Text = RS.Fields(1)
    Else
        MsgBox "库中无此数据!"
    End If
Else
    MsgBox "主键不能为空!"
End If
End Sub
Private Sub cmdModify_Click()
'修改
If Trim(Me.cboName.Text) <> "" Then
    Sql = "select * from 种类表 where 种类名='" & Trim(Me.cboName.Text) & "'"
    Set RS = dbSelect(Sql)
    If Not RS.EOF Then
        Sql = "update 种类表 set 说明='" & Trim(Me.txtP.Text)
        Sql = "' where 种类名='" & Trim(Me.cboName.Text) & "'"
        dbOperate Sql
    Else
        MsgBox "库中无此数据!"
    End If
Else
    MsgBox "主键不能为空!"
End If
End Sub
Private Sub Form_Load()
'初始化
Sql = "select 种类名 from 种类表"
Set RS = dbSelect(Sql)
While Not RS.EOF
    Me.cboName.AddItem RS.Fields(0)
    RS.MoveNext
Wend
End Sub

⌨️ 快捷键说明

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