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

📄 frmaddemployee.frm

📁 使用vb开发的课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddEmployee 
   Caption         =   "员工添加"
   ClientHeight    =   2730
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5850
   LinkTopic       =   "Form1"
   ScaleHeight     =   2730
   ScaleWidth      =   5850
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&C)"
      Height          =   375
      Left            =   3120
      TabIndex        =   6
      Top             =   2160
      Width           =   1335
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加(&A)"
      Height          =   375
      Left            =   1320
      TabIndex        =   5
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "员工信息"
      Height          =   1935
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5535
      Begin VB.TextBox txtTitle 
         Height          =   285
         Left            =   3720
         TabIndex        =   14
         Top             =   1320
         Width           =   1695
      End
      Begin VB.TextBox txtDepart 
         Height          =   285
         Left            =   1200
         TabIndex        =   13
         Top             =   1320
         Width           =   1335
      End
      Begin VB.TextBox txtBirthDate 
         Height          =   285
         Left            =   3720
         TabIndex        =   10
         Top             =   840
         Width           =   1695
      End
      Begin VB.ComboBox cboSex 
         Height          =   315
         Left            =   1200
         TabIndex        =   8
         Top             =   840
         Width           =   1215
      End
      Begin VB.TextBox txtName 
         Height          =   285
         Left            =   3720
         TabIndex        =   4
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox txtNo 
         Height          =   285
         Left            =   1200
         TabIndex        =   3
         Text            =   " "
         Top             =   360
         Width           =   1335
      End
      Begin VB.Label Label6 
         Caption         =   "职        务:"
         Height          =   255
         Left            =   2760
         TabIndex        =   12
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label5 
         Caption         =   "所属部门:"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "出生日期:"
         Height          =   255
         Left            =   2760
         TabIndex        =   9
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "性        别:"
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "员工姓名:"
         Height          =   255
         Left            =   2760
         TabIndex        =   2
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "员工编号:"
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   1095
      End
   End
End
Attribute VB_Name = "frmAddEmployee"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public sqlStr As String
Public msgText As String

Private Sub cmdAdd_Click()
 Dim rstMember As ADODB.Recordset
  
    If txtNo.Text = "" Or txtName.Text = "" Then
    
       MsgBox "请将信息填写完整", vbOKOnly + vbExclamation, "警告"
 
       Exit Sub
    
    End If

 '添加新记录
 sqlStr = "select * from employee"
 Set rstMember = ExecuteSQL(sqlStr, msgText)
 rstMember.AddNew
 rstMember.Fields("employeeNo") = txtNo.Text
 rstMember.Fields("employeeName") = txtName.Text
 rstMember.Fields("sex") = cboSex.Text
 rstMember.Fields("birthdate") = txtBirthDate.Text
 rstMember.Fields("department") = txtDepart.Text
 rstMember.Fields("title") = txtTitle.Text
 rstMember.Update
 rstMember.Close
     
 MsgBox "员工信息添加完成!", vbOKOnly + vbExclamation, "警告"
 initForm

End Sub

Private Sub cmdCancel_Click()
Unload Me

End Sub

Private Sub Form_Load()

'窗体居中显示
Me.Top = (Screen.Height - Me.Height) \ 2
Me.Left = (Screen.Width - Me.Width) \ 2

initForm

End Sub

Sub initForm()
txtName = ""
txtNo = ""
txtBirthDate = ""
txtDepart = ""
txtTitle = ""
cboSex.Clear
cboSex.AddItem "男"
cboSex.AddItem "女"
cboSex.ListIndex = 0

End Sub

⌨️ 快捷键说明

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