So i am trying to change the password of a user in my vb.net project that i been working on. but everytime i run my code i get me catch "Something went wrong". i can't figur out why. i am using a MYSQL database. can anybody help me?
Try
reader = cmd.ExecuteReader()
Dim found As Boolean = False
Do While reader.Read()
If username = DirectCast(reader("username"), String) Then
If password = DirectCast(reader("password"), String) Then
found = True
Else
MessageBox.Show("username and password do not match")
End If
End If
If found = True Then
Dim cmd2 As New MySqlCommand
Dim insertStatment As String = "UPDATE login set password = '" +
newpassword + "' where username = '" + username + "'" , con)
cmd2.ExecuteNonQuery()
MessageBox.Show("password change successfully")
'End If
End If
Loop
Catch
MessageBox.Show("Something went wrong")