hi all! i'm new here. i just learnt this asp.net and not very good at it. anyway, i'm having trouble in updating the password. it's like this; every user can change their current password, and when they change their password, they have to enter their old password, and then type a new one and re-type again to confirm the new password. the code that i've written is like this:
Sub Page_Load() lblDisplayId.text=Session("UserName") End Sub
Sub OK(sender As Object, e As EventArgs) If txtOldPwd.text = "" AND txtNewPwd.text = "" AND txtConNewPwd.text="" Then lblRequired1.text="Please fill in all fields!" ElseIf txtOldPwd.text = "" AND txtNewPwd.text = "" Then lblRequired1.text="Please enter your Old and New Password!" ElseIf txtOldPwd.text = "" AND txtConNewPwd.text="" Then lblRequired1.text="Please enter your Old and Confirm New Password!" ElseIf txtNewPwd.text = "" AND txtConNewPwd.text="" Then lblRequired1.text="Please enter your New and Confirm New Password!"
Dim connectionString As OleDbConnection Dim strSelectPwd As String Dim strUpdatePwd As String Dim data As New DataSet()
connectionString = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; " & _ "Ole DB Services=-4; Data Source='EzySys.mdb'") connectionString.Open()
strSelectPwd = "SELECT Resident_Pwd FROM resident_info WHERE Resident_ID='" & Session("UserName") & "'"
Dim cmdSelectPwd As New OLEDBCommand(strSelectPwd,connectionString) Dim cmdUpdatePwd As New OLEDBCommand(strUpdatePwd,connectionString)
Dim Dr As OLEDBDataReader=cmdSelectPwd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
If Dr.Read() If Dr("Resident_Pwd").ToString = txtOldPwd.text Then If (txtNewPwd.text) = (txtConNewPwd.text) Then strUpdatePwd = "UPDATE resident_info SET Resident_Pwd = txtNewPwd.text WHERE Resident_ID = '" & Session("UserName") & "'" Else lblRequired1.text="Please enter the same new and confirm password!" End If Else lblRequired1.text = "Incorrect old password!" End If End If
Dr.Close connectionString.Close() End If End Sub
Sub Cancel(sender As Object, e As EventArgs) Response.Redirect("res_mainpage.aspx") End Sub
User ID :
Old Password :
New Password :
Confirm New Password :
so, i checked my database to see if the new password had replaced the old one. but the problem is, it doesn't! i still have the same old password in the database! and there is no error messages that are generated when i run it with Web Matrix! so, ladies & gentlemen, what could have been wrong here???