📄 add_user.frm
字号:
VERSION 5.00
Begin VB.Form add_user
BackColor = &H80000013&
Caption = "添加用户"
ClientHeight = 3255
ClientLeft = 60
ClientTop = 465
ClientWidth = 5760
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3255
ScaleWidth = 5760
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 375
Left = 2040
TabIndex = 8
Top = 1920
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 6
Top = 2520
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确认"
Height = 375
Left = 960
TabIndex = 5
Top = 2520
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2040
PasswordChar = "*"
TabIndex = 4
Top = 1320
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 2040
TabIndex = 1
Top = 720
Width = 2295
End
Begin VB.Label Label5
BackColor = &H80000013&
Caption = "确认密码:"
Height = 375
Left = 840
TabIndex = 7
Top = 1920
Width = 1095
End
Begin VB.Label Label3
BackColor = &H80000013&
Caption = "用户密码:"
Height = 255
Left = 960
TabIndex = 3
Top = 1320
Width = 975
End
Begin VB.Label Label2
BackColor = &H80000013&
Caption = "用户姓名:"
Height = 255
Left = 960
TabIndex = 2
Top = 840
Width = 1095
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "请输入用户名:"
Height = 255
Left = 360
TabIndex = 0
Top = 120
Width = 1455
End
End
Attribute VB_Name = "add_user"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim msgText As String
If Trim(Text1.Text) = "" Then
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, "提示"
Exit Sub
Text1.SetFocus
Else
txtSQL = "select * from g_user"
Set mrc = ExecuteSQL(txtSQL, msgText)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(Text1.Text) Then
MsgBox "用户名已经存在", vbOKOnly + vbExclamation, "提示"
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Exit Sub
Else
mrc.MoveNext
End If
Wend
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "两次密码输入不一致", vbOKOnly + vbExclamation, "提示"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Exit Sub
ElseIf Trim(Text2.Text) = "" Then
MsgBox "用户密码不能为空", vbOKOnly + vbExclamation, "提示"
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Exit Sub
Else
mrc.AddNew
mrc.Fields(0) = Trim(Text1.Text)
mrc.Fields(1) = Trim(Text2.Text)
mrc.Update
mrc.Close
MsgBox "添加用户成功", vbOKOnly + vbExclamation, ""
Unload Me
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -