📄 changepass.aspx.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
Partial Class hr_ChangePass
Inherits System.Web.UI.Page
Dim cs As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
Protected Sub bnSubmit_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles bnSubmit.Click
Page.Validate("vg1")
If Page.IsValid() Then
Dim con As SqlConnection = New SqlConnection(cs)
Dim cmd1 As SqlCommand = New SqlCommand("select UID from HRPASSTAB where (UID=@uid)and(PASS=@pass) ", con)
cmd1.Parameters.AddWithValue("@uid", txbUID.Text.ToString())
cmd1.Parameters.AddWithValue("@pass", txbOldPass.Text.ToString())
Try
con.Open()
Dim dr As SqlDataReader = cmd1.ExecuteReader()
If dr.Read() Then
con.Close()
Dim cmd As SqlCommand = New SqlCommand("update HRPASSTAB set PASS=@pass where(UID=@uid) ", con)
cmd.Parameters.AddWithValue("@uid", txbUID.Text.ToString())
cmd.Parameters.AddWithValue("@pass", txbPass.Text.ToString())
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Response.Redirect("~/hr/Success1.aspx?ID=" + Request.QueryString(ID))
Else
lbError.Text = "Type correct password and User ID"
End If
Catch ex As Exception
lbError.Text = lbError.Text.ToString() + ex.Message.ToString()
End Try
End If
End Sub
Protected Sub bnCancel_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles bnCancel.Click
Response.Redirect("~/hr/HRHome.aspx?ID=" + Request.QueryString(ID))
End Sub
Protected Sub txbOldPass_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txbOldPass.TextChanged
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -