📄 addmanagerfrom.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form AddManagerFrom
Caption = "添加经理"
ClientHeight = 5355
ClientLeft = 60
ClientTop = 420
ClientWidth = 6750
LinkTopic = "Form1"
ScaleHeight = 5355
ScaleWidth = 6750
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "请输入新员工的资料:"
Height = 4215
Left = 240
TabIndex = 2
Top = 120
Width = 6255
Begin VB.TextBox Text1
Height = 270
Left = 720
TabIndex = 15
Top = 3240
Width = 1335
End
Begin VB.TextBox Text3
Height = 270
Left = 3240
TabIndex = 14
Top = 480
Width = 2775
End
Begin VB.TextBox Text5
Height = 270
Left = 3240
TabIndex = 13
Top = 1560
Width = 2775
End
Begin VB.TextBox Text6
Height = 270
Left = 3240
TabIndex = 12
Top = 1920
Width = 2775
End
Begin VB.TextBox Text7
Height = 270
Left = 3240
TabIndex = 11
Top = 2280
Width = 2775
End
Begin VB.TextBox Text9
Height = 270
Left = 3240
TabIndex = 10
Top = 3000
Width = 2775
End
Begin VB.CommandButton Command1
Caption = "导入照片"
Height = 375
Left = 600
TabIndex = 9
Top = 2760
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "AddManagerFrom.frx":0000
Left = 3240
List = "AddManagerFrom.frx":000A
TabIndex = 8
Top = 1200
Width = 2775
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "AddManagerFrom.frx":0016
Left = 3240
List = "AddManagerFrom.frx":0026
TabIndex = 7
Top = 3360
Width = 2775
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 720
PasswordChar = "*"
TabIndex = 6
Top = 3720
Width = 1335
End
Begin VB.TextBox Text8
Height = 270
Left = 3240
TabIndex = 5
Top = 2640
Width = 2775
End
Begin VB.TextBox Text10
Height = 270
IMEMode = 3 'DISABLE
Left = 3240
PasswordChar = "*"
TabIndex = 4
Top = 3720
Width = 2775
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "AddManagerFrom.frx":004A
Left = 3240
List = "AddManagerFrom.frx":0054
TabIndex = 3
Text = "经理"
Top = 840
Width = 2775
End
Begin VB.Image Image1
Height = 2175
Left = 240
Stretch = -1 'True
Top = 360
Width = 1935
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名:"
Height = 180
Left = 2400
TabIndex = 27
Top = 570
Width = 450
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "性别:"
Height = 180
Left = 2400
TabIndex = 26
Top = 1320
Width = 450
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "年龄:"
Height = 180
Left = 2400
TabIndex = 25
Top = 1650
Width = 450
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "户口状况:"
Height = 180
Left = 2400
TabIndex = 24
Top = 2010
Width = 810
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "政治面貌:"
Height = 180
Left = 2400
TabIndex = 23
Top = 2370
Width = 810
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "生理状况:"
Height = 180
Left = 2400
TabIndex = 22
Top = 2730
Width = 810
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "合同:"
Height = 180
Left = 2400
TabIndex = 21
Top = 3090
Width = 450
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "所属部门:"
Height = 180
Left = 2400
TabIndex = 20
Top = 3420
Width = 810
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "工号:"
Height = 180
Left = 240
TabIndex = 19
Top = 3240
Width = 450
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "密码:"
Height = 180
Left = 240
TabIndex = 18
Top = 3810
Width = 450
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "职位:"
Height = 180
Left = 2400
TabIndex = 17
Top = 930
Width = 450
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "确认密码:"
Height = 180
Left = 2400
TabIndex = 16
Top = 3810
Width = 810
End
End
Begin VB.CommandButton Command2
Caption = "确定(&O)"
Height = 375
Left = 4080
TabIndex = 1
Top = 4560
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "取消(&C)"
Height = 375
Left = 5400
TabIndex = 0
Top = 4560
Width = 1095
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 360
Top = 4680
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 = "select * from BaseTable"
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
End
Attribute VB_Name = "AddManagerFrom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Combo2_Click()
If Combo2.List(Combo2.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 Command2_Click()
If Trim(Text1.Text) = "" Then
MsgBox "工号不能为空。", vbInformation, "添加错误"
Exit Sub
End If
'检测帐号是否存在
Adodc1.RecordSource = "select * from BaseTable where BID='" & Trim(Text1.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = False And Adodc1.Recordset.BOF = False Then '如果帐号重复
MsgBox "工号重复", vbExclamation, "添加失败"
Exit Sub
End If
Adodc1.Recordset.Close
'检查男女
If Combo1.Text = "男" Or Combo1.Text = "女" Then
Else
MsgBox "性别错误,只允许“男”或者“女”。", vbExclamation, "添加失败"
Exit Sub
End If
'检测年龄
If Val(Text5.Text) <= 0 Or Str(Val(Text5.Text)) = "" Then
MsgBox "年龄输入大于0岁。", vbExclamation, "添加失败"
End If
'检测密码
If Trim(Text2.Text) = "" Or Trim(Text10.Text) = "" Then
MsgBox "密码输入错误", vbExclamation, "添加失败"
Exit Sub
End If
If Trim(Text2.Text) <> Trim(Text10.Text) Then
MsgBox "确认密码输入错误", vbExclamation, "添加失败"
Exit Sub
End If
'添加数据
AdministrationForm.Enabled = True
AdministrationForm.Adodc1.RecordSource = "select BID 工号,BName 姓名,BDepartment 部门,BAge 年龄,BSex 性别, BResidence 户口状况,BPolity 政治面貌,BHealthy 生理状况,BAgreement 合同,BDepartment 所属部门,BPassword 密码,BPosition 职位 from basetable where BPosition in ('经理')"
AdministrationForm.Adodc1.Refresh
AdministrationForm.Adodc1.Recordset.MoveLast
AdministrationForm.Adodc1.Recordset.AddNew
AdministrationForm.Adodc1.Recordset.Fields("工号") = Trim(Text1.Text)
AdministrationForm.Adodc1.Recordset.Fields("密码") = Trim(Text2.Text)
AdministrationForm.Adodc1.Recordset.Fields("姓名") = Trim(Text3.Text)
AdministrationForm.Adodc1.Recordset.Fields("职位") = Trim(Combo3.Text)
AdministrationForm.Adodc1.Recordset.Fields("性别") = Trim(Combo1.Text)
AdministrationForm.Adodc1.Recordset.Fields("年龄") = Val(Text5.Text)
AdministrationForm.Adodc1.Recordset.Fields("户口状况") = Trim(Text6.Text)
AdministrationForm.Adodc1.Recordset.Fields("政治面貌") = Trim(Text7.Text)
AdministrationForm.Adodc1.Recordset.Fields("生理状况") = Trim(Text8.Text)
AdministrationForm.Adodc1.Recordset.Fields("合同") = Trim(Text9.Text)
AdministrationForm.Adodc1.Recordset.Fields("所属部门") = Trim(Combo2.Text)
AdministrationForm.Adodc1.Recordset.Update
AdministrationForm.Adodc1.Refresh
Unload Me
End Sub
Private Sub Command3_Click()
AdministrationForm.Enabled = True
Unload Me
End Sub
Private Sub Form_Load()
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_QueryUnload(Cancel As Integer, UnloadMode As Integer)
AdministrationEForm.Enabled = True
AdministrationEForm.Adodc1.RecordSource = "select BID 工号,BName 姓名,BDepartment 部门,BAge 年龄,BSex 性别, BResidence 户口状况,BPolity 政治面貌,BHealthy 生理状况,BAgreement 合同,BDepartment 所属部门,BPassword 密码,BPosition 职位 from basetable where BPosition in ('经理')"
AdministrationEForm.Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -