📄 frmchguserpasswd.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmChgUserPasswd
BorderStyle = 3 'Fixed Dialog
Caption = "修改、查看用户密码"
ClientHeight = 3105
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
Icon = "FrmChgUserPasswd.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3105
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "关闭(&C)"
Height = 375
Left = 2760
TabIndex = 5
Top = 2400
Width = 975
End
Begin VB.CommandButton CmdChgPass
Caption = "修改(&D)"
Height = 375
Left = 960
TabIndex = 4
Top = 2400
Width = 975
End
Begin VB.TextBox TxtNewPasswdC
Height = 390
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 3
Top = 1680
Width = 3015
End
Begin VB.TextBox TxtNewPasswd
Height = 390
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 2
Top = 1200
Width = 3015
End
Begin VB.TextBox TxtPasswd
Height = 390
IMEMode = 3 'DISABLE
Left = 1440
TabIndex = 1
Top = 720
Width = 3015
End
Begin VB.TextBox TxtUserID
Height = 390
Left = 1440
TabIndex = 0
Top = 240
Width = 3015
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 0
Top = 2040
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
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 = ""
OLEDBString = ""
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.Label Label4
AutoSize = -1 'True
Caption = "确认密码:"
Height = 180
Left = 360
TabIndex = 9
Top = 1800
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "新密码:"
Height = 180
Left = 540
TabIndex = 8
Top = 1320
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "查看旧密码:"
Height = 180
Left = 180
TabIndex = 7
Top = 840
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户帐号:"
Height = 180
Left = 360
TabIndex = 6
Top = 360
Width = 900
End
End
Attribute VB_Name = "FrmChgUserPasswd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdChgPass_Click()
On Error GoTo errEnd
If TxtUserID.Text = "" Then
MsgBox "请输入用户的帐号!", vbOKOnly + vbExclamation, "更改密码"
TxtUserID.SetFocus
Exit Sub
End If
If TxtNewPasswd.Text = "" Then
MsgBox "请输入用户的新密码!", vbOKOnly + vbExclamation, "更改密码"
TxtNewPasswd.SetFocus
Exit Sub
End If
If TxtNewPasswd.Text <> TxtNewPasswdC.Text Then
MsgBox "密码输入不一致,请重试!", vbOKOnly + vbExclamation, "更改密码"
TxtPasswd.Text = ""
TxtNewPasswd.Text = ""
TxtNewPasswdC.Text = ""
TxtPasswd.SetFocus
Exit Sub
End If
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from [Admin] where [用户ID]=""" & TxtUserID.Text & """"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!用户密码 = TxtNewPasswd.Text
Adodc1.Recordset.Update
Else
MsgBox "该用户不存在!无法修改密码!", vbOKOnly + vbExclamation, "密码错误"
TxtPasswd.Text = ""
TxtNewPasswd.Text = ""
TxtNewPasswdC.Text = ""
Exit Sub
End If
MsgBox "用户密码修改成功!请牢记!", vbOKOnly + vbInformation, "更改密码"
TxtPasswd.Text = ""
TxtNewPasswd.Text = ""
TxtNewPasswdC.Text = ""
Exit Sub
errEnd:
MsgBox Err.Description & vbCrLf & "更改密码失败!", vbOKOnly + vbExclamation, "操作数据库出错"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim dbName As String
Dim connSTR As String
On Error GoTo errEnd
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\WFSSDataBase.mdb"
connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName & ";Persist Security Info=False"
Adodc1.ConnectionString = connSTR
Exit Sub
errEnd:
MsgBox Err.Description, vbOKOnly + vbExclamation, "打开数据库出错"
End Sub
Private Sub TxtPasswd_Click()
Dim ret As Integer
On Error GoTo errEnd
If TxtUserID.Text <> "" Then
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select [用户密码] from [Admin] where [用户ID]=""" & TxtUserID.Text & """"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
TxtPasswd.Text = Adodc1.Recordset!用户密码
Else
ret = MsgBox("该用户帐号不存在!", vbOKCancel + vbInformation, "更改用户密码")
If ret = vbOK Then
TxtUserID.SetFocus
TxtUserID.SelStart = 0
TxtUserID.SelLength = Len(TxtUserID.Text)
Else
Unload Me
End If
End If
End If
Exit Sub
errEnd:
MsgBox Err.Description, vbOKOnly + vbExclamation, "打开数据库出错"
End Sub
Private Sub TxtUserID_LostFocus()
Call TxtPasswd_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -