📄 administrationeform.frm
字号:
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ManageSystem"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ManageSystem"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from basetable where BPosition in ('员工','维护部员工)"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1920
Top = 0
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ManageSystem"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ManageSystem"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = $"AdministrationEForm.frx":006A
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "管理:"
Height = 1695
Left = 480
TabIndex = 5
Top = 3720
Width = 1455
End
Begin VB.Frame Frame3
Caption = "人员一览表:"
Height = 5415
Left = 120
TabIndex = 14
Top = 240
Width = 6375
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1
Bindings = "AdministrationEForm.frx":0160
Height = 3015
Left = 360
TabIndex = 15
Top = 360
Width = 5895
_ExtentX = 10398
_ExtentY = 5318
_Version = 393216
Cols = 5
_NumberOfBands = 1
_Band(0).Cols = 5
_Band(0).GridLinesBand= 1
_Band(0).TextStyleBand= 0
_Band(0).TextStyleHeader= 0
_Band(0)._NumMapCols= 12
_Band(0)._MapCol(0)._Name= "工号"
_Band(0)._MapCol(0)._RSIndex= 0
_Band(0)._MapCol(1)._Name= "姓名"
_Band(0)._MapCol(1)._RSIndex= 1
_Band(0)._MapCol(2)._Name= "部门"
_Band(0)._MapCol(2)._RSIndex= 2
_Band(0)._MapCol(3)._Name= "年龄"
_Band(0)._MapCol(3)._RSIndex= 3
_Band(0)._MapCol(3)._Alignment= 7
_Band(0)._MapCol(3)._Hidden= -1 'True
_Band(0)._MapCol(4)._Name= "性别"
_Band(0)._MapCol(4)._RSIndex= 4
_Band(0)._MapCol(4)._Hidden= -1 'True
_Band(0)._MapCol(5)._Name= "户口状况"
_Band(0)._MapCol(5)._RSIndex= 5
_Band(0)._MapCol(5)._Hidden= -1 'True
_Band(0)._MapCol(6)._Name= "政治面貌"
_Band(0)._MapCol(6)._RSIndex= 6
_Band(0)._MapCol(6)._Hidden= -1 'True
_Band(0)._MapCol(7)._Name= "生理状况"
_Band(0)._MapCol(7)._RSIndex= 7
_Band(0)._MapCol(7)._Hidden= -1 'True
_Band(0)._MapCol(8)._Name= "合同"
_Band(0)._MapCol(8)._RSIndex= 8
_Band(0)._MapCol(8)._Hidden= -1 'True
_Band(0)._MapCol(9)._Name= "所属部门"
_Band(0)._MapCol(9)._RSIndex= 9
_Band(0)._MapCol(9)._Hidden= -1 'True
_Band(0)._MapCol(10)._Name= "密码"
_Band(0)._MapCol(10)._RSIndex= 10
_Band(0)._MapCol(10)._Hidden= -1 'True
_Band(0)._MapCol(11)._Name= "职位"
_Band(0)._MapCol(11)._RSIndex= 11
End
End
End
Attribute VB_Name = "AdministrationEForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo2_Click()
If Combo2.List(Combo3.ListIndex) = "维护部" Then
Combo3.Text = "维护部员工"
End If
End Sub
Private Sub Combo3_Click()
If Combo3.List(Combo3.ListIndex) = "维护部员工" Then
Combo2.Text = "维护部"
End If
End Sub
Private Sub Command1_Click()
AddEmployeeFrom.Show
Me.Enabled = False
End Sub
Private Sub Command10_Click()
Me.Width = 6780
End Sub
Private Sub Command11_Click()
If Text3.Text = "" Then '没有选择员工
MsgBox "请选择需要修改的员工。", vbCritical, "修改失败"
Exit Sub
End If
'检测性别
If Combo1.Text = "男" Or Combo1.Text = "女" Then '该工号重复
Else
MsgBox "性别只能为男或女!", vbCritical, "修改错误"
Exit Sub
End If
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "工号='" & Text3.Text & "'"
Adodc1.Recordset.Fields("工号") = Text3.Text
Adodc1.Recordset.Fields("姓名") = Text4.Text
Adodc1.Recordset.Fields("性别") = Combo1.Text
Adodc1.Recordset.Fields("年龄") = Text5.Text
Adodc1.Recordset.Fields("户口状况") = Text6.Text
Adodc1.Recordset.Fields("政治面貌") = Text7.Text
Adodc1.Recordset.Fields("生理状况") = Text8.Text
Adodc1.Recordset.Fields("合同") = Text9.Text
Adodc1.Recordset.Fields("所属部门") = Combo2.Text
Adodc1.Recordset.Fields("职位") = Combo3.Text
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "数据已成功修改数据库。", vbInformation, "修改成功。"
If Combo3.Text = "经理" Then '清空修改表
Text3.Text = ""
Command12_Click
End If
End Sub
Private Sub Command12_Click() '清空输入框
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
End Sub
Private Sub Command2_Click()
Me.Width = 11310
End Sub
Private Sub Command3_Click()
Dim myval As Integer
If Text3.Text = "" Then '还没有选择要删除的员工
MsgBox "请选择要删除的员工。", vbCritical, "删除错误"
Exit Sub
End If
myval = MsgBox("请慎重确定是否删除员工" & Text3.Text & "。" & vbCrLf & "因为该操作将会及联删除该员工的考勤、培训等等的信息,而且操作不可逆。", vbQuestion + vbYesNo, "请确认是否删除")
If myval = vbNo Then Exit Sub '如果选择取消,那就取消操作
'删除考勤表中数据
Set Ado_Conn = New ADODB.Connection
Set Ado_RS = New ADODB.Recordset
str_CS = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ManageSystem"
str_RS = "select * from ExtendTable"
SqlConnect Ado_Conn, Ado_RS, str_CS, str_RS
Ado_Conn.Execute "select * from ExtendTable where EID='" & Adodc1.Recordset.Fields("工号") & "'"
SqlDisConnect Ado_RS
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "工号='" & Text3.Text & "'"
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "已经成功从数据库中把工号为 " & Text3.Text & " 删除。"
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click() '退出
SureExit
End Sub
Private Sub Command6_Click() '查询
If Text1.Text = "" And Text2.Text = "" Then '工号,姓名都为空
MsgBox "请输入工号或者姓名", vbExclamation, "查询错误"
Exit Sub
End If
If Text1.Text <> "" And Text2.Text = "" Then '只填了工号
Adodc1.RecordSource = "select BID 工号,BName 姓名,BDepartment 部门, BAge 年龄, BSex 性别, BResidence 户口状况, BPolity 政治面貌, BHealthy 生理状况, BAgreement 合同, BDepartment 所属部门 , BPosition 职位 from basetable where BPosition in ('员工','维护部员工') and BID='" & Text1.Text & "'"
Adodc1.Refresh
End If
If Text1.Text = "" And Text2.Text <> "" Then '只填了姓名
Adodc1.RecordSource = "select BID 工号,BName 姓名,BDepartment 部门, BAge 年龄, BSex 性别, BResidence 户口状况, BPolity 政治面貌, BHealthy 生理状况, BAgreement 合同, BDepartment 所属部门 , BPosition 职位 from basetable where BPosition in ('员工','维护部员工') and BName='" & Text2.Text & "'"
Adodc1.Refresh
End If
If Text1.Text <> "" And Text2.Text <> "" Then '只填了工号&姓名
Adodc1.RecordSource = "select BID 工号,BName 姓名,BDepartment 部门, BAge 年龄, BSex 性别, BResidence 户口状况, BPolity 政治面貌, BHealthy 生理状况, BAgreement 合同, BDepartment 所属部门 , BPosition 职位 from basetable where BPosition in ('员工','维护部员工') and BID='" & Text1.Text & "' and BName='" & Text2.Text & "'"
Adodc1.Refresh
End If
'没有找到信息
If MSHFlexGrid1.Rows <= 1 Then
MsgBox "找不到该人员,请确认该人员帐号的存在。", vbCritical, "查找出错"
Exit Sub
End If
'输出信息
Adodc1.Refresh
If Adodc1.Recordset.Fields("工号").Value <> "" Then Text3.Text = Adodc1.Recordset.Fields("工号").Value
If Adodc1.Recordset.Fields("姓名").Value <> "" Then Text4.Text = Adodc1.Recordset.Fields("姓名").Value
If Adodc1.Recordset.Fields("性别").Value <> "" Then Combo1.Text = Adodc1.Recordset.Fields("性别").Value
If Adodc1.Recordset.Fields("年龄").Value <> "" Then Text5.Text = Adodc1.Recordset.Fields("年龄").Value
If Adodc1.Recordset.Fields("户口状况").Value <> "" Then Text6.Text = Adodc1.Recordset.Fields("户口状况").Value
If Adodc1.Recordset.Fields("政治面貌").Value <> "" Then Text7.Text = Adodc1.Recordset.Fields("政治面貌").Value
If Adodc1.Recordset.Fields("生理状况").Value <> "" Then Text8.Text = Adodc1.Recordset.Fields("生理状况").Value
If Adodc1.Recordset.Fields("合同").Value <> "" Then Text9.Text = Adodc1.Recordset.Fields("合同").Value
If Adodc1.Recordset.Fields("所属部门").Value <> "" Then Combo2.Text = Adodc1.Recordset.Fields("所属部门").Value
If Adodc1.Recordset.Fields("职位").Value <> "" Then Combo3.Text = Adodc1.Recordset.Fields("职位").Value
End Sub
Private Sub Command7_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command8_Click() '还原
Adodc1.RecordSource = "select BID 工号,BName 姓名,BDepartment 部门,BAge 年龄,BSex 性别, BResidence 户口状况,BPolity 政治面貌,BHealthy 生理状况,BAgreement 合同,BDepartment 所属部门,BPassword 密码,BPosition 职位 from basetable where BPosition in ('员工','维护部员工')"
Adodc1.Refresh
End Sub
Private Sub Form_Load()
If user_Position = "总裁" Then
Combo3.AddItem "经理"
End If
End Sub
Private Sub MSHFlexGrid1_SelChange()
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "工号='" & MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1) & "'"
If Adodc1.Recordset.Fields("工号").Value <> "" Then Text3.Text = Adodc1.Recordset.Fields("工号").Value
If Adodc1.Recordset.Fields("姓名").Value <> "" Then Text4.Text = Adodc1.Recordset.Fields("姓名").Value
If Adodc1.Recordset.Fields("性别").Value <> "" Then Combo1.Text = Adodc1.Recordset.Fields("性别").Value
If Adodc1.Recordset.Fields("年龄").Value <> "" Then Text5.Text = Adodc1.Recordset.Fields("年龄").Value
If Adodc1.Recordset.Fields("户口状况").Value <> "" Then Text6.Text = Adodc1.Recordset.Fields("户口状况").Value
If Adodc1.Recordset.Fields("政治面貌").Value <> "" Then Text7.Text = Adodc1.Recordset.Fields("政治面貌").Value
If Adodc1.Recordset.Fields("生理状况").Value <> "" Then Text8.Text = Adodc1.Recordset.Fields("生理状况").Value
If Adodc1.Recordset.Fields("合同").Value <> "" Then Text9.Text = Adodc1.Recordset.Fields("合同").Value
If Adodc1.Recordset.Fields("所属部门").Value <> "" Then Combo2.Text = Adodc1.Recordset.Fields("所属部门").Value
If Adodc1.Recordset.Fields("职位").Value <> "" Then Combo3.Text = Adodc1.Recordset.Fields("职位").Value
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -