📄 frmadduser.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmadduser
Caption = "添加用户"
ClientHeight = 4215
ClientLeft = 60
ClientTop = 450
ClientWidth = 4785
LinkTopic = "Form1"
ScaleHeight = 4215
ScaleWidth = 4785
StartUpPosition = 3 '窗口缺省
Begin VB.OptionButton Option2
Caption = "普通用户"
Height = 375
Left = 2640
TabIndex = 9
Top = 2040
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "管理员"
Height = 375
Left = 720
TabIndex = 8
Top = 2040
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 720
Top = 3360
Visible = 0 'False
Width = 3255
_ExtentX = 5741
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student_data\student_massage.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student_data\student_massage.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2760
TabIndex = 7
Top = 2640
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 480
TabIndex = 6
Top = 2640
Width = 1335
End
Begin VB.TextBox password2
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 5
Top = 1440
Width = 2415
End
Begin VB.TextBox password1
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 4
Top = 960
Width = 2415
End
Begin VB.TextBox newusername
Height = 375
Left = 1800
TabIndex = 1
Top = 360
Width = 2415
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "确认密码"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 3
Top = 1440
Width = 1200
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "密 码"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 2
Top = 960
Width = 1200
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "新用户名"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 480
TabIndex = 0
Top = 360
Width = 1200
End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim myexit As Integer
If Trim$(newusername.Text) = "" Then
MsgBox "请输入用户名", vbExclamation, "提示"
newusername.SetFocus
Exit Sub
End If
If Trim$(password1.Text) = "" Then
MsgBox "请输入密码", vbExclamation, "提示"
newusername.SetFocus
Exit Sub
End If
If Trim$(password2.Text) = "" Then
MsgBox "请确认密码", vbExclamation, "提示"
newusername.SetFocus
Exit Sub
End If
If Trim$(password1.Text) <> Trim$(password2.Text) Then
MsgBox "两次密码输入不一致,请重新输入", vbExclamation, "提示"
Call FocusBack(password2)
Exit Sub
End If
Adodc1.RecordSource = "select * from 用户 where 用户名='" & newusername.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If .BOF Then
.AddNew
.Fields(0).Value = Trim$(newusername.Text)
.Fields(1).Value = Trim$(password1.Text)
If Option1 = True Then .Fields(2).Value = "管理员"
If Option2 = True Then .Fields(2).Value = "普通"
.Update
myexit = MsgBox("添加用户成功!", vbOKOnly, "添加成功")
If myexit = 1 Then Unload Me
Else
MsgBox "此用户已经存在", vbExclamation, "错误"
Call FocusBack(newusername)
Exit Sub
End If
End With
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -