📄 modpassword.frm
字号:
VERSION 5.00
Begin VB.Form modPassword
BorderStyle = 1 'Fixed Single
Caption = "修改密码"
ClientHeight = 2970
ClientLeft = 45
ClientTop = 330
ClientWidth = 4185
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2970
ScaleWidth = 4185
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 375
Left = 2400
TabIndex = 8
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "修改密码(&U)"
Height = 375
Left = 360
TabIndex = 7
Top = 2400
Width = 1215
End
Begin VB.Frame Frame1
Caption = "修改密码"
Height = 2055
Left = 120
TabIndex = 0
Top = 120
Width = 3855
Begin VB.TextBox Text3
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
ToolTipText = "再次输入新密码进行核对"
Top = 1440
Width = 1695
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
ToolTipText = "输入新密码"
Top = 960
Width = 1695
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 1800
TabIndex = 1
ToolTipText = "登录系统用户的用户名"
Top = 480
Width = 1695
End
Begin VB.Label Label3
Caption = "再次输入密码:"
Height = 255
Left = 360
TabIndex = 6
Top = 1440
Width = 1335
End
Begin VB.Label Label2
Caption = "请输入新密码:"
Height = 255
Left = 360
TabIndex = 5
Top = 960
Width = 1335
End
Begin VB.Label Label1
Caption = "您的用户名为:"
Height = 255
Left = 360
TabIndex = 4
Top = 480
Width = 1335
End
End
End
Attribute VB_Name = "modPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim txtSQL As String
Dim MsgText As String
Dim MRC As ADODB.Recordset
If (Text2.Text = "") Then
If (Text3.Text <> "") Then
MsgBox "输入的新密码不能为空!", vbOKOnly + vbApplicationModal, "成绩管理系统"
Text3.Text = ""
Text2.SetFocus
Else
MsgBox "输入的新密码不能为空!", vbOKOnly + vbApplicationModal, "成绩管理系统"
Text2.SetFocus
End If
Else
If ((Text2.Text <> Text3.Text) And (Text3.Text <> "")) Then
MsgBox "两次输入的密码不一致!", vbOKOnly + vbApplicationModal, "成绩管理系统"
Text3.SetFocus
Text3.Text = ""
ElseIf ((Text2.Text <> Text3.Text) And (Text3.Text = "")) Then
MsgBox "再次输入的新密码不能为空!", vbOKOnly + vbApplicationModal, "成绩管理系统"
Text3.SetFocus
Text3.Text = ""
Else
'---------------------------------使用UPDATE语句进行修改密码处理----------------------------------
txtSQL = "UPDATE userLogin SET password='" & Trim(Text2.Text) & "' WHERE username='" & Trim(Text1.Text) & "'"
Set MRC = ExecuteSQL(txtSQL, MsgText)
If (MsgText = "UPDATE query successful") Then
MsgBox "密码修改成功!", vbOKOnly + vbInformation, "成绩管理系统"
Else
MsgBox "'" + MsgText + "'", vbOKOnly + vbCritical, "警告"
End If
Text2.Text = ""
Text3.Text = ""
Unload Me
End If
'--------------------------------------------------------------------------------------
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Move (frmMain.ScaleWidth - Me.Width) / 2, (frmMain.ScaleHeight - Me.Height) / 2
Me.Text1.Text = frmLogin.txtusername.Text
Me.Text1.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -