📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmadduser
BackColor = &H00C0FFFF&
Caption = "添加用户"
ClientHeight = 4635
ClientLeft = 60
ClientTop = 450
ClientWidth = 6660
LinkTopic = "Form1"
ScaleHeight = 4635
ScaleMode = 0 'User
ScaleWidth = 5506.592
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 495
Left = 3480
TabIndex = 9
Top = 3240
Width = 1469
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 495
Left = 1680
TabIndex = 8
Top = 3240
Width = 1469
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2640
TabIndex = 7
Text = "Combo1"
Top = 2640
Width = 1575
End
Begin VB.TextBox txtqueren
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 6
Top = 2040
Width = 1575
End
Begin VB.TextBox txtpwd
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 4
Top = 1440
Width = 1575
End
Begin VB.TextBox txtname
Height = 375
Left = 2640
TabIndex = 3
Top = 840
Width = 1575
End
Begin VB.Label Label4
BackColor = &H00C0FFFF&
Caption = "用户权限"
Height = 180
Left = 1440
TabIndex = 2
Top = 2640
Width = 720
End
Begin VB.Label Label3
BackColor = &H00C0FFFF&
Caption = "确认密码"
Height = 180
Left = 1440
TabIndex = 1
Top = 2040
Width = 720
End
Begin VB.Label Label2
BackColor = &H00C0FFFF&
Caption = "输入密码"
Height = 180
Left = 1440
TabIndex = 0
Top = 1440
Width = 720
End
Begin VB.Label Label1
BackColor = &H00C0FFFF&
Caption = "输入用户名"
Height = 180
Left = 1320
TabIndex = 5
Top = 840
Width = 900
End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdok_Click()
Dim sql As String
Dim rs_add As New ADODB.Recordset
If Trim(txtname.Text) = "" Then
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, ""
Exit Sub
txtname.SetFocus
Else
sql = "select * from 系统管理"
rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
While (rs_add.EOF = False)
If Trim(rs_add.Fields(0)) = Trim(txtname.Text) Then
MsgBox "已有这个用户", vbOKOnly + vbExclamation, ""
txtname.SetFocus
txtname.Text = ""
txtpwd.Text = ""
txtqueren.Text = ""
Combo1.Text = ""
Exit Sub
Else
rs_add.MoveNext
End If
Wend
If Trim(txtpwd.Text) <> Trim(txtqueren.Text) Then
MsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""
txtpwd.SetFocus
txtpwd.Text = ""
txtqueren.Text = ""
Exit Sub
ElseIf Trim(Combo1.Text) <> "system" And Trim(Combo1.Text) <> "guest" Then
MsgBox "请选择正确的用户权限", vbOKOnly + vbExclamation, ""
Combo1.SetFocus
Combo1.Text = ""
Exit Sub
Else
rs_add.AddNew
rs_add.Fields(0) = txtname.Text
rs_add.Fields(1) = txtpwd.Text
rs_add.Fields(2) = Combo1.Text
rs_add.Update
rs_add.Close
MsgBox "添加用户成功", vbOKOnly + vbExclamation, ""
Unload Me
End If
End If
End Sub
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.AddItem "system"
Combo1.AddItem "guest"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -