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

📄 main_jbxx_xsryxx.frm

📁 基于VB + SQL Server 的商品进销管理,是学习VB数据库编程的重要参考
💻 FRM
字号:
VERSION 5.00
Begin VB.Form main_jbxx_xsryxx 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "基本信息管理-【销售人员信息管理】"
   ClientHeight    =   3360
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6900
   Icon            =   "main_jbxx_xsryxx.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3360
   ScaleWidth      =   6900
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton CmdEnd 
      Caption         =   "返回"
      Height          =   390
      Left            =   3555
      TabIndex        =   17
      Top             =   2835
      Width           =   1935
   End
   Begin VB.CommandButton CmdSave 
      Caption         =   "保存"
      Height          =   390
      Left            =   1470
      TabIndex        =   14
      Top             =   2835
      Width           =   1935
   End
   Begin VB.Frame Frame2 
      Height          =   2700
      Left            =   60
      TabIndex        =   0
      Top             =   45
      Width           =   6735
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   4875
         TabIndex        =   18
         Top             =   765
         Width           =   1710
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   0
         Left            =   1080
         Locked          =   -1  'True
         TabIndex        =   15
         Top             =   285
         Width           =   1485
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   5
         Left            =   1080
         TabIndex        =   6
         Top             =   1695
         Width           =   2730
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   3
         Left            =   1065
         TabIndex        =   5
         Top             =   1230
         Width           =   2730
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   1
         Left            =   1080
         TabIndex        =   4
         Top             =   765
         Width           =   2730
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   6
         Left            =   4890
         TabIndex        =   3
         Top             =   1695
         Width           =   1710
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   4
         Left            =   4875
         TabIndex        =   2
         Top             =   1230
         Width           =   1710
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   7
         Left            =   1080
         TabIndex        =   1
         Top             =   2160
         Width           =   5505
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "编    号:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   6
         Left            =   120
         TabIndex        =   16
         Top             =   375
         Width           =   1095
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "联系电话:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   5
         Left            =   3930
         TabIndex        =   13
         Top             =   1770
         Width           =   1065
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "身份证号:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   4
         Left            =   150
         TabIndex        =   12
         Top             =   1755
         Width           =   1065
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "文化程度:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   3
         Left            =   3930
         TabIndex        =   11
         Top             =   1320
         Width           =   1065
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "出生日期:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   2
         Left            =   150
         TabIndex        =   10
         Top             =   1320
         Width           =   1065
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "性    别:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   1
         Left            =   3930
         TabIndex        =   9
         Top             =   855
         Width           =   1065
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "姓    名:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   0
         Left            =   150
         TabIndex        =   8
         Top             =   840
         Width           =   1125
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "联系地址:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   7
         Left            =   150
         TabIndex        =   7
         Top             =   2220
         Width           =   1065
      End
   End
End
Attribute VB_Name = "main_jbxx_xsryxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer     '定义整型变量
Dim rs1 As New ADODB.Recordset     '定义数据集对象
Private Sub Form_Activate()
  Text1(1).SetFocus
End Sub
Private Sub Form_Load()
  Combo1.AddItem ("女")
  Combo1.AddItem ("男")
  Combo1.ListIndex = 0
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn And Index < 7 And Index > 1 Then Text1(Index + 1).SetFocus '回车获得焦点
  If KeyCode = vbKeyReturn And Index = 1 Then Combo1.SetFocus
  If KeyCode = vbKeyReturn And Index = 7 Then CmdSave.SetFocus
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Text1(3).SetFocus
End Sub
Private Sub CmdSave_Click()
  Dim a As String
  rs1.Open "select * from 销售人员信息表 where 销售员编号='" & Text1(0).Text & "'order by 销售员编号", Cnn, adOpenKeyset, adLockOptimistic
  If rs1.RecordCount > 0 Then
     a = MsgBox("您确实要修改这条数据吗?", vbYesNo)
     If a = vbYes Then
        If Text1(0).Text <> "" Then rs1.Fields(0) = Trim(Text1(0).Text)
        If Text1(1).Text <> "" Then rs1.Fields(1) = Trim(Text1(1).Text)
        If Combo1.Text <> "" Then rs1.Fields(2) = Trim(Combo1.Text)
        For i = 3 To 7
            rs1.Fields(i) = Trim(Text1(i).Text)
        Next i
        rs1.Update
        main_jbxx_xsrycx.Adodc1.Refresh
     End If
  Else
     If Text1(1).Text <> "" Then
       '添加销售人员信息
        rs1.AddNew
        rs1.Fields(0) = Trim(Text1(0).Text)
        rs1.Fields(1) = Trim(Text1(1).Text)
        rs1.Fields(2) = Trim(Combo1.Text)
        For i = 3 To 7
            rs1.Fields(i) = Trim(Text1(i).Text)
        Next i
       '更新数据库
       rs1.Update
       main_jbxx_xsrycx.Adodc1.Refresh
     Else
       MsgBox "请填写完整的信息"
     End If
  End If
  '关闭数据集对象
  rs1.Close
  Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
  frm_main.Enabled = True
End Sub
Private Sub CmdEnd_Click()
  Unload Me
End Sub


⌨️ 快捷键说明

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