📄 passchange.aspx.vb
字号:
Public Class passchange
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents btnChange As System.Web.UI.WebControls.Button
Protected WithEvents txtRetypeNewPass As System.Web.UI.WebControls.TextBox
Protected WithEvents txtNewPass As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCurrentPass As System.Web.UI.WebControls.TextBox
Protected WithEvents lblFeedback As System.Web.UI.WebControls.Label
Protected WithEvents lblUsername As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
lblUsername.Text = Session("UserName")
End Sub
Private Sub btnChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChange.Click
Dim sSQL As String
Dim dacc As New DataAccessBase
If LCase(txtNewPass.Text) <> LCase(txtRetypeNewPass.Text) Then
lblFeedback.ForeColor = Color.Red
lblFeedback.Text = "** New Passwords can not be confirmed."
Exit Sub
End If
Try
dacc.Open(Session("connDbControl"))
dacc.IsWrapBrackets = True
dacc.IsFillSchema = True
sSQL = "SELECT * FROM Persons WHERE PersonId = '" & lblUsername.Text & "' AND PASSWORD = '" & txtCurrentPass.Text & "';"
Dim ds As DataSet = dacc.GetData("Persons", sSQL)
If ds.Tables("Persons").Rows.Count = 1 Then
ds.Tables("Persons").Rows(0).Item("Password") = txtNewPass.Text
dacc.PutData(ds, "Persons")
lblFeedback.ForeColor = Color.Green
lblFeedback.Text = "Password Successfully Changed."
Else
lblFeedback.ForeColor = Color.Red
lblFeedback.Text = "** Information Not Correct."
End If
Catch ex As Exception
lblFeedback.ForeColor = Color.Red
lblFeedback.Text = "ERROR: " & ex.Message
Finally
dacc.Close()
End Try
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -