📄 frm_adduser.frm
字号:
VERSION 5.00
Begin VB.Form frm_adduser
Caption = "添加用户"
ClientHeight = 2550
ClientLeft = 60
ClientTop = 450
ClientWidth = 4155
LinkTopic = "Form1"
ScaleHeight = 2550
ScaleWidth = 4155
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Fault
Caption = "取消"
Height = 375
Left = 2400
TabIndex = 8
Top = 2040
Width = 1095
End
Begin VB.CommandButton cmd_add
Caption = "添加"
Height = 375
Left = 840
TabIndex = 7
Top = 2040
Width = 1095
End
Begin VB.Frame Frame1
Height = 1575
Left = 360
TabIndex = 0
Top = 240
Width = 3615
Begin VB.TextBox checkpassword
Height = 285
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 6
Top = 1080
Width = 1695
End
Begin VB.TextBox password
Height = 285
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 1695
End
Begin VB.TextBox username
Height = 285
Left = 1560
TabIndex = 2
Top = 360
Width = 1695
End
Begin VB.Label Label3
Caption = "重复密码"
Height = 255
Left = 120
TabIndex = 5
Top = 1080
Width = 1215
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 120
TabIndex = 3
Top = 720
Width = 1215
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 1215
End
End
End
Attribute VB_Name = "frm_adduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_add_Click()
Dim strSQL As String
If Username.Text = "" Then
MsgBox "用户名不能为空", vbOKOnly
Exit Sub
End If
If Password.Text <> checkpassword.Text Then
MsgBox "两次输入密码不同", vbOKOnly
Password.SetFocus
Exit Sub
Else
OpenDB
strSQL = "Select * from Users where username ='" + Trim(Username.Text) + "'"
objRS.Open strSQL, objConn, adOpenDynamic, adLockOptimistic
If objRS.EOF Then
objRS.AddNew
objRS.Fields(0).Value = Trim(Username.Text)
objRS.Fields(1).Value = Trim(Password.Text)
objRS.Update
objRS.Close
CloseDB
MsgBox "用户已添加", vbOKOnly
Unload Me
Exit Sub
Else
objRS.Close
CloseDB
MsgBox "用户名已存在", vbOKOnly
Exit Sub
End If
End If
End Sub
Private Sub fault_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -