Click here to Skip to main content
16,019,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim cmd As New OleDbCommand
Dim con As New OleDbConnection
Dim da As New OleDbDataAdapter
If (BunifuTextbox3.text = BunifuTextbox4.text) Then


    Try
        con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Login.accdb")
        con.Open()
        Dim ds As New DataSet
        da = New OleDbDataAdapter("select * from Logintb where Username = '" & (BunifuTextbox1.text) & "' and Pswd = ' " & (BunifuTextbox2.text) & "'", con)
        If da.Fill(ds) Then

            cmd = New OleDbCommand("update Logintb set [Pswd] = '" & BunifuTextbox3.text & "' where Username = '" & BunifuTextbox1.text & "'and Pswd = '" & BunifuTextbox2.text & "'", con)
            cmd.ExecuteNonQuery()
            MessageBox.Show("PASSWORD CHANGE SUCCESSFULLY")
            con.Close()
            Me.Hide()
            Form1.Show()
        Else
            MsgBox("INVALID PASSWORD OR USERNAME")
        End If

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
Else
    MsgBox("NEW AND RETRY PASSWORD IS NOT MATCH")

End If


What I have tried:

pls help it i am trying correct (old password) and entering new password but it is showing the incorrect msgbox..
Posted
Updated 29-Jul-17 13:08pm
Comments
Richard MacCutchan 30-Jul-17 4:25am    
People who store passwords in clear text really should not be working in this industry.

1 solution

Not a solution to your question, but another problem you have.
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[^]
SQL Injection[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900