b) 员工是否能够正常查看自己的考勤信息;
c) 管理员是否能够正常的查询、添加、修改、删除员工考勤信息。
(2)测试结果:
a)该功能运行正常。登录系统后,进入主界面后点击相应按钮可以进入员工考勤信息模块的一系列界面;
b)员工可以正常查看自己的考勤信息;
c)管理员可以成功查询、添加、修改、删除员工考勤信息。
(3)运行界面&主要程序代码
图4.8 员工考勤信息查看界面
图4.9 员工考勤信息界面
添加功能部分代码:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
If cn.State = 1 Then
cn.Close
End If
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\111.mdb;" & _
"Persist Security Info=False"
cn.Open
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\111.mdb;" & _
"Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 员工考勤信息表"
Adodc1.Refresh
End Sub
Private Sub Command2_Click()
If Text1.Text = "" Or _
Text2.Text = "" Or _
Text3.Text = "" Or _
DTPicker1.Value = "" Or _
Text5.Text = "" Or _
Text6.Text = "" Or _
Text7.Text = "" Or _
Text8.Text = "" Or _
Text9.Text = "" Or _
Text10.Text = "" Or _
Text11.Text = "" Or _
Combo1.Text = "" Then
MsgBox "未添加成功"
Else
str1 = "select * from 员工考勤信息表 where 考勤编号='" & Text1.Text & "'"
If rs.State = 1 Then
rs.Close
End If
rs.Open str1, cn, 1, 3
If rs.EOF Then
rs.AddNew
rs("考勤编号") = Text1.Text
rs("员工编号") = Text2.Text
rs("员工姓名") = Text3.Text