📄 forpass.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form ForPass
Caption = "修改密码"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton ComEsc
Caption = "取消"
Height = 495
Left = 3000
TabIndex = 9
Top = 2310
Width = 1215
End
Begin VB.CommandButton ComEnter
Caption = "确定"
Height = 495
Left = 420
TabIndex = 8
Top = 2340
Width = 1215
End
Begin VB.TextBox TextUser
Appearance = 0 'Flat
Enabled = 0 'False
Height = 285
Left = 2025
TabIndex = 7
Top = 345
Width = 2055
End
Begin VB.TextBox TextPass
Height = 300
IMEMode = 3 'DISABLE
Left = 2025
PasswordChar = "*"
TabIndex = 1
Top = 765
Width = 2040
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 270
Top = 15
Visible = 0 'False
Width = 1995
_ExtentX = 3519
_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.TextBox TextPassB
Height = 285
IMEMode = 3 'DISABLE
Left = 2025
PasswordChar = "*"
TabIndex = 5
Top = 1680
Width = 2055
End
Begin VB.TextBox TextPassA
Height = 270
IMEMode = 3 'DISABLE
Left = 2010
PasswordChar = "*"
TabIndex = 4
Top = 1230
Width = 2070
End
Begin VB.Label Label4
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 390
TabIndex = 6
Top = 390
Width = 1170
End
Begin VB.Label Label3
Caption = "确认密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 345
TabIndex = 3
Top = 1725
Width = 1230
End
Begin VB.Label Label2
Caption = "新密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 375
TabIndex = 2
Top = 1260
Width = 1170
End
Begin VB.Label Label1
Caption = "旧密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 375
TabIndex = 0
Top = 810
Width = 1170
End
End
Attribute VB_Name = "ForPass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub ComEnter_Click()
Dim Temp
Dim I As Integer
Temp = 0
'注释:查找用户 Adodc1.'连接到表"Adm"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst '指向第一条记录
For I = 1 To Adodc1.Recordset.RecordCount '记录的数量.
If TextUser.Text = Adodc1.Recordset("用户名") Then
If TextPass.Text = Adodc1.Recordset("密码") Then
If TextPassA.Text = "" Then
MsgBox ("新密码不能为空!!")
'注释:提示用户:"新密码不能为空!!!"
Exit Sub '注释:跳出Sub
End If
If TextPassA.Text = TextPassB.Text Then
Temp = 1
Adodc1.Recordset("密码") = TextPassA.Text
Adodc1.Recordset.Update
DoEvents
'注释:将新密码保存到数据库.
Temp = MsgBox("密码修改成功,请记住新密码!!!", vbOKOnly, "成功")
'注释:提示用户:"密码修改成功,请记住新密码!!!"
'注释:登记登录的用户
Unload Me '注释:卸载本窗口
Else
Temp = MsgBox("两次输入的密码不一致!!!,请重新输入", vbOKOnly, "错误")
'注释:提示用户:"两次输入的密码不一致!!!,请重新输入"
TextPassA.Text = "" '注释:把新密码置空.
TextPassB.Text = "" '注释:把新密码置空.
TextPassA.SetFocus
End If
Exit For '注释:跳出For
End If
End If
Adodc1.Recordset.MoveNext '注释:指向下一条记录
DoEvents
Next I
If Temp = 0 Then
Temp = MsgBox("密码错误!!!", vbOKOnly, "错误")
'注释:提示用户:"密码!!!错误"
TextPass.SetFocus
End If
End Sub
Private Sub ComEsc_Click()
Unload Me
End Sub
Private Sub Form_Load()
'------------------------
'注释:'连接到数据库.(管理员)
With Adodc1
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Jing.mdb;Mode=ReadWrite;Persist Security Info=False"
.CommandType = adCmdTable
.RecordSource = "用户" '注释:'连接到表"Adm" 注意:表名不可以用"USER"
.Refresh '注释:刷新
End With
'------------------------
TextUser.Text = ForMain.TextMain.Text '注释:传递用户名.
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -