📄 newusers.frm
字号:
VERSION 5.00
Begin VB.Form newusers
Caption = "添加新用户"
ClientHeight = 4860
ClientLeft = 135
ClientTop = 420
ClientWidth = 7800
LinkTopic = "Form1"
ScaleHeight = 4860
ScaleWidth = 7800
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "创建新的管理员用户"
ForeColor = &H00764E10&
Height = 2625
Left = 1200
TabIndex = 0
Top = 1320
Width = 4905
Begin VB.CommandButton command1
BackColor = &H00E2D1D3&
Caption = "创建"
Default = -1 'True
Height = 375
Left = 1800
MaskColor = &H00987758&
Style = 1 'Graphical
TabIndex = 6
Top = 2145
UseMaskColor = -1 'True
Width = 1335
End
Begin VB.CommandButton Command2
BackColor = &H00E2D1D3&
Caption = "取消"
Height = 375
Left = 3165
MaskColor = &H00987758&
Style = 1 'Graphical
TabIndex = 5
Top = 2145
UseMaskColor = -1 'True
Width = 1335
End
Begin VB.TextBox txtpass
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
IMEMode = 3 'DISABLE
Left = 1785
MaxLength = 10
PasswordChar = "*"
TabIndex = 4
ToolTipText = "Enter Password Here"
Top = 840
Width = 2745
End
Begin VB.TextBox txtlogin
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
Left = 1785
MaxLength = 15
TabIndex = 3
ToolTipText = "Enter LogIn ID Here"
Top = 405
Width = 2745
End
Begin VB.TextBox txtpass2
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
IMEMode = 3 'DISABLE
Left = 1785
MaxLength = 10
PasswordChar = "*"
TabIndex = 2
ToolTipText = "Enter Password Here"
Top = 1275
Width = 2745
End
Begin VB.TextBox txtadmin
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
IMEMode = 3 'DISABLE
Left = 1785
MaxLength = 10
PasswordChar = "*"
TabIndex = 1
ToolTipText = "Enter Password Here"
Top = 1725
Width = 2745
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "登录密码:"
ForeColor = &H00987758&
Height = 285
Left = 315
TabIndex = 10
Top = 870
Width = 1425
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "登录账号:"
ForeColor = &H00987758&
Height = 285
Left = 345
TabIndex = 9
Top = 435
Width = 1425
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "确认密码:"
ForeColor = &H00987758&
Height = 285
Left = 60
TabIndex = 8
Top = 1305
Width = 1665
End
Begin VB.Label Label7
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "管理员密码:"
ForeColor = &H00987758&
Height = 285
Left = 0
TabIndex = 7
Top = 1755
Width = 1755
End
End
End
Attribute VB_Name = "newusers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub command1_Click()
If txtlogin.Text = "" Then
MsgBox "Enter a Login ID:", vbCritical
txtlogin.SetFocus
Exit Sub
End If
If txtpass.Text = "" Then
MsgBox "Enter A Password:", vbCritical
txtpass.SetFocus
Exit Sub
End If
If txtpass2.Text = "" Then
MsgBox "Enter a Confirmation Password:", vbCritical
txtpass2.SetFocus
Exit Sub
End If
If txtpass.Text <> txtpass2.Text Then
MsgBox "Password & Confirm Passwords Donot Match!", vbCritical
txtpass.Text = ""
txtpass2.Text = ""
txtpass.SetFocus
Exit Sub
End If
If txtadmin.Text = "" Then
MsgBox "Enter An Administrator Password:", vbCritical
txtadmin.SetFocus
Exit Sub
End If
Call openconn
sqlstr = "select * from users where loginid = '" & administrator & "' and pass = '" & txtadmin.Text & "'"
Call rs(sqlstr)
If (adoRS.EOF) Then
MsgBox "Wrong Administrator Password! Try Again With Correct Administrator Password", vbCritical
txtadmin.Text = ""
txtadmin.SetFocus
Call closeconn
Exit Sub
End If
Call closeconn
Call openconn
sqlstr = "select * from users where loginid = '" & txtlogin.Text & "'"
Call rs(sqlstr)
If Not (adoRS.EOF) Then
MsgBox "Login ID Already Exists! Enter New Login ID", vbCritical
txtlogin.Text = ""
txtlogin.SetFocus
Call closeconn
Exit Sub
End If
Call closeconn
Call openconn
sqlstr = "insert into users values('" & Crypt(txtlogin.Text) & "','" & Crypt(txtpass.Text) & "')"
Call rs(sqlstr)
Call closeconn
MsgBox "New User Created Successfully!", vbInformation
Unload Me
End Sub
Private Sub command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -