📄 frmmodifyappraise.frm
字号:
VERSION 5.00
Begin VB.Form frmModifyAppraise
Caption = "修改评价"
ClientHeight = 4920
ClientLeft = 60
ClientTop = 345
ClientWidth = 7080
LinkTopic = "Form1"
ScaleHeight = 4920
ScaleWidth = 7080
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdCancel
Caption = "返回(&C)"
Height = 375
Left = 3840
TabIndex = 18
Top = 4320
Width = 1335
End
Begin VB.CommandButton cmdUpdate
Caption = "修改(&U)"
Height = 375
Left = 1560
TabIndex = 17
Top = 4320
Width = 1335
End
Begin VB.Frame Frame1
Caption = "评价信息"
Height = 3015
Index = 1
Left = 120
TabIndex = 6
Top = 1080
Width = 6855
Begin VB.TextBox txtNo
Enabled = 0 'False
Height = 285
Left = 4320
TabIndex = 22
Top = 360
Width = 1695
End
Begin VB.TextBox txtName
Height = 285
Left = 1200
TabIndex = 20
Text = "Text1"
Top = 360
Width = 1575
End
Begin VB.TextBox txtApp
Height = 495
Index = 0
Left = 1200
TabIndex = 11
Text = "Text1"
Top = 720
Width = 5415
End
Begin VB.TextBox txtApp
Height = 495
Index = 1
Left = 1200
TabIndex = 10
Text = "Text2"
Top = 1320
Width = 5415
End
Begin VB.TextBox txtApp
Enabled = 0 'False
Height = 285
Index = 3
Left = 1200
TabIndex = 9
Text = "Text3"
Top = 2520
Width = 1815
End
Begin VB.TextBox txtApp
Enabled = 0 'False
Height = 285
Index = 4
Left = 4440
TabIndex = 8
Text = "Text4"
Top = 2520
Width = 1695
End
Begin VB.TextBox txtApp
Height = 495
Index = 2
Left = 1200
TabIndex = 7
Text = "Text5"
Top = 1920
Width = 5415
End
Begin VB.Label Label9
Caption = "编号:"
Height = 255
Left = 3720
TabIndex = 21
Top = 360
Width = 975
End
Begin VB.Label Label8
Caption = "员工姓名:"
Height = 255
Left = 240
TabIndex = 19
Top = 360
Width = 975
End
Begin VB.Label Label3
Caption = "工作成绩:"
Height = 255
Left = 240
TabIndex = 16
Top = 720
Width = 975
End
Begin VB.Label Label4
Caption = "工作态度:"
Height = 375
Left = 240
TabIndex = 15
Top = 1920
Width = 975
End
Begin VB.Label Label5
Caption = "工作水平:"
Height = 375
Left = 240
TabIndex = 14
Top = 1320
Width = 975
End
Begin VB.Label Label6
Caption = "评 价 人:"
Height = 255
Left = 240
TabIndex = 13
Top = 2520
Width = 975
End
Begin VB.Label Label7
Caption = "评价时间:"
Height = 255
Left = 3480
TabIndex = 12
Top = 2520
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "查询"
Height = 855
Index = 0
Left = 120
TabIndex = 0
Top = 120
Width = 6855
Begin VB.CommandButton cmdQuery
Caption = "查询(&Q)"
Height = 375
Left = 5640
TabIndex = 5
Top = 360
Width = 1095
End
Begin VB.TextBox txtKeyName
Height = 375
Left = 4200
TabIndex = 3
Text = "Text1"
Top = 360
Width = 1335
End
Begin VB.ComboBox cboNo
Height = 315
Left = 1440
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.Label Label2
Caption = "评价人姓名:"
Height = 255
Index = 0
Left = 3120
TabIndex = 4
Top = 360
Width = 1095
End
Begin VB.Label Label1
Caption = "被评员工编号:"
Height = 255
Index = 0
Left = 240
TabIndex = 1
Top = 360
Width = 1335
End
End
End
Attribute VB_Name = "frmModifyAppraise"
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
Private Sub cmdQuery_Click()
queryAppraise
End Sub
Private Sub cmdUpdate_Click()
Dim conn As ADODB.Connection
sqlStr = "update appraise set performance='" & txtApp(0).Text _
& "',[level]='" & txtApp(1).Text & "',attitude='" _
& txtApp(2).Text & "',appraisedate=#" & Format(Date, "yyyy-mm-dd") _
& "# where [no]=" & txtNo.Text
On Error GoTo exitSub
Set conn = New ADODB.Connection
conn.Open connStr
conn.Execute sqlStr
MsgBox "成功修改数据!!"
initForm
exitSub:
conn.Close
End Sub
Private Sub Form_Load()
initEmployeeNo
initForm
txtKeyName = ""
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
Sub queryAppraise()
Dim rstAppraise As ADODB.Recordset
'从数据库中查找符合条件的评价信息,如果找到,就在窗体上显示出来
sqlStr = "select employeeBasic.name,performance," _
& "attitude,[no],[level],appraiseDate,appraiser" _
& " from employeeBasic,appraise" _
& " where appraiser='" & txtKeyName.Text _
& "' AND appraise.employeeNo='" & cboNo.Text _
& "' AND appraise.employeeNo=employeeBasic.employeeNo"
Set rstAppraise = ExecuteSQL(sqlStr, msgText)
If Not rstAppraise.EOF Then
txtName.Text = rstAppraise.Fields("name")
txtApp(0).Text = rstAppraise.Fields("performance")
txtApp(1).Text = rstAppraise.Fields("level")
txtApp(2).Text = rstAppraise.Fields("attitude")
txtApp(3).Text = rstAppraise.Fields("appraiser")
txtApp(4).Text = rstAppraise.Fields("appraiseDate")
txtNo.Text = rstAppraise.Fields("no")
Else
MsgBox "没有找到评价信息!", vbOKOnly + vbExclamation, "警告"
initForm
Exit Sub
End If
rstAppraise.Close
End Sub
Sub initForm()
txtName = ""
txtApp(0) = ""
txtApp(1) = ""
txtApp(2) = ""
txtApp(3) = ""
txtApp(4) = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -