附录 原代码:
A、员工信息查询代码:
Private rd As New ADODB.Recordset
Private Sub Command1_Click()
MSHFlexGrid1.Clear
If rd.State = adStateOpen Then
rd.Close
End If
If Combo1.Text = "姓名" Then
rd.Open "SELECT * FROM 人事 where 姓名 = '" & Text2.Text & "'", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = rd
End If
If Combo1.Text = "员工编号" Then
str1 = Text2.Text
If (IsNumeric(str1) = False) Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
rd.Open "SELECT * FROM 人事表单 where 编号 = '" & Text2.Text & "'", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = rd
End If
If Combo1.Text = "所在部门" Then
rd.Open "SELECT * FROM 人事 where 部门名称 = '" & Text2.Text & "'", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = rd
End If
If MSHFlexGrid1.Rows = 1 Then
MsgBox ("查无相符信息")
Exit Sub
End If
Text2.Text = ""
End Sub
B、员工信息操作及工资管理代码:
Private rd As New ADODB.Recordset
Private ra As New ADODB.Recordset
Private rb As New ADODB.Recordset
Public cname As String
Public cnum As String
Private Sub Command1_Click()
If rd.State = adStateOpen Then
rd.Close
End If
If (Text1.Text = "") Or (Text9.Text = "") Or (Text5.Text = "") Or (Text7.Text = "") Or (Combo1.Text = "") Or (Text7.Text = "") Or (Combo1.Text = "") Or (Combo2.Text = "") Or (Combo3.Text = "") Or (Combo4.Text = "") Or (Combo5.Text = "") Or (Combo6.Text = "") Or (Combo7.Text = "") Or (Combo8.Text = "") Or (Combo9.Text = "") Or (Combo10.Text = "") Then
MsgBox ("请填写所有信息")
Exit Sub
End If
str1 = Text7.Text
If (IsNumeric(str1) = False) Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
If str1 > 99999999 Or str1 < 10000000 Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
If (Combo8.Text - Combo5.Text) < 19 Then
MsgBox ("您的年龄输入有错误")
Exit Sub
End If
rd.Open "SELECT * FROM 人事 where 编号 = '" & Text7.Text & "'", db, adOpenStatic, adLockOptimistic
If rd.BOF = False Or rd.EOF = False Then
MsgBox ("此编号已存在")
Exit Sub
End If