📄 modifykeyform.vb
字号:
Public Class ModifyKeyForm
'初始化为0
Private umode As Integer = UserMode.NobodyMode
Public Sub SetUserMode(ByVal value As Integer)
umode = value
End Sub
Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click
Dim strUser As String = LoginForm.TextUser.Text
Dim strNewKey As String = TextNewKey.Text.Trim()
Dim strConfirmKey As String = TextConfirmKey.Text.Trim()
'验证输入的新密码是否为空
If strNewKey = "" Then
MsgBox("输入的新密码不能为空!", MsgBoxStyle.Exclamation, "错误")
Exit Sub
End If
'验证两次输入的密码是否一致
If strNewKey <> strConfirmKey Then
MsgBox("两次输入的密码不一致,请重试!", MsgBoxStyle.Exclamation, "错误")
TextNewKey.Text = ""
TextConfirmKey.Text = ""
Exit Sub
End If
Dim hasUpdate As Boolean
'修改密码
Select Case umode
Case UserMode.StudentMode
Dim strSQL As String = "update student set skey='" + strNewKey + "' where suser='" + strUser + "'"
hasUpdate = DBOperation.Update(strSQL)
Case UserMode.TeacherMode
Dim strSQL As String = "update teacher set tkey='" + strNewKey + "' where tuser='" + strUser + "'"
hasUpdate = DBOperation.Update(strSQL)
Case UserMode.EduMode
Dim strSQL As String = "update edu set ekey='" + strNewKey + "' where euser='" + strUser + "'"
hasUpdate = DBOperation.Update(strSQL)
Case UserMode.AdminMode
Dim strSQL As String = "update admin set akey='" + strNewKey + "' where auser='" + strUser + "'"
hasUpdate = DBOperation.Update(strSQL)
Case Else
MsgBox("Select Error!")
End Select
If hasUpdate Then
MsgBox("密码修改成功!", MsgBoxStyle.OkOnly, "修改密码")
Else
MsgBox("密码修改失败!", MsgBoxStyle.Exclamation, "修改密码")
End If
Me.Close()
End Sub
Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -