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

📄 frmappraise.frm

📁 数据库课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAppraise 
   Caption         =   "员工评价"
   ClientHeight    =   4725
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6240
   LinkTopic       =   "Form1"
   ScaleHeight     =   4725
   ScaleWidth      =   6240
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&N)"
      Height          =   375
      Left            =   3240
      TabIndex        =   16
      Top             =   4200
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "添加(&Y)"
      Height          =   375
      Left            =   1440
      TabIndex        =   15
      Top             =   4200
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "评价信息"
      Height          =   3975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5775
      Begin VB.TextBox txtApp 
         Height          =   615
         Index           =   2
         Left            =   1200
         TabIndex        =   14
         Text            =   "Text5"
         Top             =   2640
         Width           =   4335
      End
      Begin VB.TextBox txtApp 
         Enabled         =   0   'False
         Height          =   285
         Index           =   4
         Left            =   3960
         TabIndex        =   13
         Text            =   "Text4"
         Top             =   3480
         Width           =   1575
      End
      Begin VB.TextBox txtApp 
         Height          =   285
         Index           =   3
         Left            =   1200
         TabIndex        =   11
         Text            =   "Text3"
         Top             =   3480
         Width           =   1455
      End
      Begin VB.TextBox txtApp 
         Height          =   855
         Index           =   1
         Left            =   1200
         TabIndex        =   9
         Text            =   "Text2"
         Top             =   1680
         Width           =   4335
      End
      Begin VB.TextBox txtApp 
         Height          =   735
         Index           =   0
         Left            =   1200
         TabIndex        =   8
         Text            =   "Text1"
         Top             =   840
         Width           =   4335
      End
      Begin VB.TextBox txtName 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3960
         TabIndex        =   4
         Top             =   360
         Width           =   1575
      End
      Begin VB.ComboBox cboNo 
         Height          =   315
         Left            =   1200
         TabIndex        =   2
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label7 
         Caption         =   "评价时间:"
         Height          =   255
         Left            =   2880
         TabIndex        =   12
         Top             =   3480
         Width           =   975
      End
      Begin VB.Label Label6 
         Caption         =   "评  价  人:"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   3480
         Width           =   975
      End
      Begin VB.Label Label5 
         Caption         =   "工作水平:"
         Height          =   375
         Left            =   240
         TabIndex        =   7
         Top             =   1680
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "工作态度:"
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   2640
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "工作成绩:"
         Height          =   255
         Left            =   240
         TabIndex        =   5
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "员工姓名:"
         Height          =   255
         Left            =   3000
         TabIndex        =   3
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "员工编号:"
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmAppraise"
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 cmdCancel_Click()
Unload Me
End Sub

Sub initEmployeeNo()
Dim rstEmployeeNo As ADODB.Recordset

    '从数据库中读取所有员工编号并添加到组合列表框中
    sqlStr = "select employeeNo from employeeBasic"
    Set rstEmployeeNo = ExecuteSQL(sqlStr, msgText)
    cboNo.Clear
    
    If Not rstEmployeeNo.EOF Then
        
            Do While Not rstEmployeeNo.EOF
                cboNo.AddItem Trim(rstEmployeeNo.Fields(0))
                rstEmployeeNo.MoveNext
            Loop
            cboNo.ListIndex = 0
        
    Else
        MsgBox "没有员工信息,请添加员工信息!", vbOKOnly + vbExclamation, "警告"
        
        Exit Sub
    End If
    rstEmployeeNo.Close

End Sub

Private Sub cboNo_Click()
Dim rstEmployeeName As ADODB.Recordset

    '根据员工编号从数据库中查找该员工姓名
    sqlStr = "select name from employeeBasic where employeeNo='" & cboNo.Text & "'"
    Set rstEmployeeName = ExecuteSQL(sqlStr, msgText)
    
    If Not rstEmployeeName.EOF Then
        txtName.Text = Trim(rstEmployeeName.Fields(0))
    Else
        MsgBox "没有员工信息,请添加员工信息!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If
    rstEmployeeName.Close

End Sub

Private Sub cmdOK_Click()
   Dim rstAppraise As ADODB.Recordset
   Dim i As Integer
   
   For i = 0 To 4
      If (txtApp(i).Text = "") Then
      MsgBox "请将信息填写完整", vbOKOnly + vbExclamation, "警告"
      Exit Sub
      End If
   Next i
   
    '添加新记录
    sqlStr = "select * from appraise"
    Set rstAppraise = ExecuteSQL(sqlStr, msgText)
    rstAppraise.addNew
    rstAppraise.Fields("employeeNo") = cboNo.Text
    rstAppraise.Fields("performance") = txtApp(0).Text
    rstAppraise.Fields("level") = txtApp(1).Text
    rstAppraise.Fields("attitude") = txtApp(2).Text
    rstAppraise.Fields("appraiser") = txtApp(3).Text
    rstAppraise.Fields("appraiseDate") = txtApp(4).Text
    
    rstAppraise.Update
    rstAppraise.Close
    
        
    MsgBox "员工评价添加完成!", vbOKOnly + vbExclamation, "警告"
    
    initTextBox
    initEmployeeNo

End Sub

Private Sub Form_Load()

initEmployeeNo
initTextBox

End Sub

Sub initTextBox()
Dim i As Integer

For i = 0 To 3
   txtApp(i) = ""
Next i

txtApp(4).Text = Date

End Sub

⌨️ 快捷键说明

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