📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form addYongHuForm
BorderStyle = 1 'Fixed Single
Caption = "添加用户"
ClientHeight = 4200
ClientLeft = 45
ClientTop = 435
ClientWidth = 5955
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4200
ScaleMode = 0 'User
ScaleWidth = 5955
Begin VB.CheckBox Check1
Height = 375
Left = 1560
TabIndex = 8
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3120
TabIndex = 7
Top = 3240
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 720
TabIndex = 6
Top = 3240
Width = 1455
End
Begin VB.TextBox queRenText3
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 5
Top = 1920
Width = 3735
End
Begin VB.TextBox miMaText2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 1200
Width = 3735
End
Begin VB.TextBox userNametext1
Height = 375
Left = 1560
TabIndex = 3
Top = 480
Width = 3735
End
Begin VB.Label Label4
Caption = "是否管理员"
Height = 255
Left = 360
TabIndex = 9
Top = 2640
Width = 975
End
Begin VB.Label Label3
Caption = "确认"
Height = 255
Left = 600
TabIndex = 2
Top = 2040
Width = 375
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 600
TabIndex = 1
Top = 1320
Width = 495
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 600
TabIndex = 0
Top = 600
Width = 735
End
End
Attribute VB_Name = "addYongHuForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim xiuGai As Boolean
Dim insertSQL As String
Dim tempPoint As ADODB.Recordset
Dim yongHuH As Integer
Dim xianShi As String
xiuGai = False
insertSQL = " select * from 职工表"
If (Trim(userNametext1.Text) = "") Then
MsgBox "请输入用户名", vbOKOnly + vbExclamation, "错误"
miMaText2.Text = ""
queRenText3.Text = ""
Check1.Value = False
userNametext1.SetFocus
Else
If (Trim(miMaText2.Text) = "") Then
MsgBox "请输入密码", vbOKOnly + vbExclamation, "错误"
miMaText2.Text = ""
queRenText3.Text = ""
Check1.Value = False
miMaText2.SetFocus
Else
If (Trim(queRenText3.Text) = "") Then
MsgBox "请输确认密码", vbOKOnly + vbExclamation, "错误"
miMaText2.Text = ""
queRenText3.Text = ""
Check1.Value = False
queRenText3.SetFocus
Else
If (Trim(queRenText3.Text) <> Trim(miMaText2.Text)) Then
MsgBox "两次密码不相同", vbOKOnly + vbExclamation, "错误"
miMaText2.Text = ""
queRenText3.Text = ""
Check1.Value = False
miMaText2.SetFocus
Else
xiuGai = True
End If
End If
End If
End If
If xiuGai = True Then
Set tempPoint = ExecuteSQL(insertSQL)
tempPoint.MoveLast
yongHuH = tempPoint.Fields(0)
yongHuH = yongHuH + 1
tempPoint.addNew
tempPoint.Fields(0) = yongHuH
tempPoint.Fields(1) = (Trim(userNametext1.Text))
tempPoint.Fields(2) = (Trim(miMaText2.Text))
tempPoint.Fields(3) = Check1.Value
tempPoint.Update
tempPoint.Close
xianShi = "添加成功!用户号为:" & (Str(yongHuH))
MsgBox xianShi, vbOKOnly + vbExclamation, ""
End If
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
If admin = False Then
MsgBox "您没有权限添加用户,按确认返回!", vbOKOnly + vbExclamation, "错误"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -