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

📄 frm_edit_emp.frm

📁 共享一下一个不错的东东用VB+sql开发的销售系统.里头附带:sql 和 vb 源码.
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Begin VB.Form Frm_edit_Emp 
   Caption         =   "添加员工信息"
   ClientHeight    =   4890
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5745
   LinkTopic       =   "Form1"
   ScaleHeight     =   4890
   ScaleWidth      =   5745
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   480
      Top             =   4440
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=CarSaleSys"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "CarSaleSys"
      OtherAttributes =   ""
      UserName        =   "sa"
      Password        =   "sa"
      RecordSource    =   "select * from Staff"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame Frame2 
      Caption         =   "查看客户信息"
      Height          =   735
      Index           =   0
      Left            =   120
      TabIndex        =   25
      Top             =   2760
      Width           =   5535
      Begin VB.CommandButton Cmd_first 
         Caption         =   "第一条记录"
         Height          =   375
         Left            =   360
         TabIndex        =   9
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_pre 
         Caption         =   "上一条记录"
         Height          =   375
         Left            =   1560
         TabIndex        =   10
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_next 
         Caption         =   "下一条记录"
         Height          =   375
         Left            =   2760
         TabIndex        =   11
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_final 
         Caption         =   "最后一条记录"
         Height          =   375
         Left            =   3960
         TabIndex        =   12
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "修改客户信息"
      Height          =   735
      Index           =   1
      Left            =   120
      TabIndex        =   24
      Top             =   3600
      Width           =   5535
      Begin VB.CommandButton Cmd_Exit 
         Caption         =   "退出"
         Height          =   375
         Left            =   2760
         TabIndex        =   15
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_del 
         Caption         =   "删除记录"
         Height          =   375
         Left            =   1560
         TabIndex        =   14
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_modi 
         Caption         =   "修改记录"
         Height          =   375
         Left            =   360
         TabIndex        =   13
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.TextBox txtindate 
      DataField       =   "Staff_intime"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   4080
      TabIndex        =   2
      ToolTipText     =   "如""1999-10-18"""
      Top             =   240
      Width           =   1455
   End
   Begin VB.TextBox txtbirthdate 
      DataField       =   "Staff_birth"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   5
      ToolTipText     =   "如""1981-12-18"""
      Top             =   1200
      Width           =   1455
   End
   Begin VB.TextBox txtsex 
      DataField       =   "Staff_sex"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   3
      Top             =   720
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Height          =   2655
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5535
      Begin VB.TextBox txtaddr 
         DataField       =   "Staff_addr"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   1080
         TabIndex        =   8
         Top             =   2160
         Width           =   4335
      End
      Begin VB.TextBox txttel 
         DataField       =   "Staff_tel"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   1080
         TabIndex        =   7
         Top             =   1680
         Width           =   4335
      End
      Begin VB.TextBox txtEmpname 
         DataField       =   "Staff_name"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   1080
         TabIndex        =   1
         Top             =   240
         Width           =   1455
      End
      Begin VB.TextBox txttitle 
         DataField       =   "Staff_title"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3960
         TabIndex        =   6
         Top             =   1200
         Width           =   1455
      End
      Begin VB.TextBox txtdepart 
         DataField       =   "Staff_depart"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3960
         TabIndex        =   4
         Top             =   720
         Width           =   1455
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "员工住址"
         Height          =   195
         Index           =   9
         Left            =   240
         TabIndex        =   23
         Top             =   2280
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "员工电话"
         Height          =   195
         Index           =   8
         Left            =   240
         TabIndex        =   22
         Top             =   1800
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "员工职务"
         Height          =   195
         Index           =   6
         Left            =   2880
         TabIndex        =   21
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "所在部门"
         Height          =   195
         Index           =   5
         Left            =   2880
         TabIndex        =   20
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "进入公司时间"
         Height          =   195
         Index           =   4
         Left            =   2760
         TabIndex        =   19
         Top             =   360
         Width           =   1080
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "员工生日"
         Height          =   195
         Index           =   1
         Left            =   240
         TabIndex        =   18
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "员工性别"
         Height          =   195
         Index           =   2
         Left            =   240
         TabIndex        =   17
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "员工姓名"
         Height          =   195
         Index           =   0
         Left            =   240
         TabIndex        =   16
         Top             =   360
         Width           =   720
      End
   End
End
Attribute VB_Name = "Frm_edit_Emp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public firstId As Integer
Public lastId As Integer
Public curId As Integer

Private Sub Cmd_Exit_Click()
Unload Me
End Sub

Private Sub Cmd_del_Click()

    Adodc1.Recordset.Delete
    Adodc1.Recordset.Update
    
    MsgBox ("员工记录已删除")
    
    Adodc1.RecordSource = "SELECT * FROM Staff"
    Adodc1.Refresh
End Sub

Private Sub Cmd_final_Click()
    Adodc1.Recordset.MoveLast
    Cmd_next.Enabled = False
    Cmd_pre.Enabled = True
End Sub

Private Sub Cmd_first_Click()
    Adodc1.Recordset.MoveFirst
    Cmd_pre.Enabled = False
    Cmd_next.Enabled = True
End Sub

Private Sub Cmd_modi_Click()
    curId = Adodc1.Recordset.Fields(0)
    
    Adodc1.Recordset.Fields(1).Value = Trim(txtEmpname.Text)
    Adodc1.Recordset.Fields(2).Value = Trim(txtsex.Text)
    Adodc1.Recordset.Fields(3).Value = CDate(Trim(txtbirthdate.Text))
    Adodc1.Recordset.Fields(4).Value = CDate(Trim(txtindate.Text))
    Adodc1.Recordset.Fields(5).Value = Trim(txtdepart.Text)
    Adodc1.Recordset.Fields(6).Value = Trim(txttitle.Text)
    Adodc1.Recordset.Fields(7).Value = Trim(txttel.Text)
    Adodc1.Recordset.Fields(8).Value = Trim(txtaddr.Text)
    
    Adodc1.Recordset.Update
    MsgBox ("员工记录已修改")
    
    Adodc1.RecordSource = "SELECT * FROM Staff "
    Adodc1.Refresh
        
    Do While Adodc1.Recordset.Fields(0) <> curId
        Adodc1.Recordset.Move (1)
    Loop
End Sub

Private Sub Cmd_next_Click()
    If Cmd_pre.Enabled = False Then
        Cmd_pre.Enabled = True
    End If
    
    Adodc1.Recordset.MoveNext
    
    If Adodc1.Recordset.Fields(0) = lastId Then
        Cmd_next.Enabled = False
    End If

End Sub

Private Sub Cmd_pre_Click()
    If Cmd_next.Enabled = False Then
        Cmd_next.Enabled = True
    End If
    

    Adodc1.Recordset.MovePrevious
    
    If Adodc1.Recordset.Fields(0) = firstId Then
        Cmd_pre.Enabled = False
    End If
End Sub

Private Sub Form_Load()

    Adodc1.RecordSource = "SELECT * FROM Staff"
    Adodc1.Refresh
    
    If Adodc1.Recordset.RecordCount <> 0 Then
        Adodc1.Recordset.MoveLast
        lastId = Adodc1.Recordset.Fields(0)
        Adodc1.Recordset.MoveFirst
        firstId = Adodc1.Recordset.Fields(0)
    End If
    
    Cmd_pre.Enabled = False
    If Adodc1.Recordset.RecordCount = 1 Then
       Cmd_next.Enabled = False
    End If
End Sub

⌨️ 快捷键说明

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