📄 frmchpwd.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmChPwd
BorderStyle = 1 'Fixed Single
Caption = "修改密码"
ClientHeight = 3915
ClientLeft = 45
ClientTop = 330
ClientWidth = 5565
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3915
ScaleWidth = 5565
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3600
Top = 120
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=XiaoQu"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "XiaoQu"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "UserTable"
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 cmdChPwdCancel
Caption = "取 消"
Height = 495
Left = 3240
TabIndex = 10
Top = 3240
Width = 1455
End
Begin VB.CommandButton cmdChPwdOk
Caption = "确 定"
Height = 495
Left = 1080
TabIndex = 9
Top = 3240
Width = 1455
End
Begin VB.Frame fraChPwd
Height = 2775
Left = 600
TabIndex = 0
Top = 240
Width = 4455
Begin VB.TextBox txtNewPwdagain
DataField = "Password"
DataSource = "Adodc1"
Height = 405
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 2160
Width = 2055
End
Begin VB.TextBox txtNewPwd
DataField = "Password"
DataSource = "Adodc1"
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 1560
Width = 2055
End
Begin VB.TextBox txtOldPwd
DataField = "Password"
DataSource = "Adodc1"
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 2
Top = 960
Width = 2055
End
Begin VB.TextBox txtChUser
DataField = "Username"
DataSource = "Adodc1"
Height = 375
Left = 1560
TabIndex = 1
Top = 360
Width = 2055
End
Begin VB.Label lblPwdagain
Caption = "新密码:"
Height = 375
Left = 480
TabIndex = 8
Top = 2280
Width = 855
End
Begin VB.Label lblNewPwd
Caption = "新密码:"
Height = 375
Left = 480
TabIndex = 7
Top = 1680
Width = 855
End
Begin VB.Label lblOldPwd
Caption = "原密码:"
Height = 375
Left = 480
TabIndex = 6
Top = 1080
Width = 855
End
Begin VB.Label lblChUser
Caption = "用户名:"
Height = 375
Left = 480
TabIndex = 5
Top = 480
Width = 855
End
End
End
Attribute VB_Name = "frmChPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdChPwdCancel_Click()
Unload Me
End Sub
Private Sub cmdChPwdOk_Click()
Dim rstUser As New ADODB.Recordset
Dim sql As String
'先检测两次输入的新密码时候一样
If txtNewPwd.Text <> txtNewPwdagain.Text Then
MsgBox "两次输入的密码不同!请重新输入", vbOKOnly + vbInformation, ""
'光标定位于新密码textbox中
txtNewPwd.SetFocus
txtNewPwd.Text = ""
txtNewPwdagain.Text = ""
Exit Sub
End If
'先检查此用户名及密码是否正确
sql = "select * from UserTable where Username = '" & txtChUser.Text & "' and " _
& " Password= '" & txtOldPwd.Text & "'"
rstUser.Open sql, conn, adOpenKeyset, adLockPessimistic
If rstUser.EOF = True Then
MsgBox "老用户名或密码错误!", vbOKOnly + vbExclamation, ""
txtChUser.Text = ""
txtChUser.SetFocus
txtOldPwd.Text = ""
rstUser.Close
Exit Sub
Else
'修改密码
rstUser.Fields(1) = txtNewPwd.Text
rstUser.Update
MsgBox "修改密码成功!", vbOKOnly + vbInformation, ""
rstUser.Close
Unload Me
End If
End Sub
Private Sub Form_Load()
Dim X0 As Long
Dim Y0 As Long
'让窗体居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -