如何解决旧密码确认
我在更改密码时遇到问题。我想通过确认旧密码然后更改密码来简化它。这是我的代码
Private Sub btnCChangePass_Click(sender As Object,e As EventArgs) Handles btnCChangePass.Click
Dim ConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\VB.net\My Projects\InventoryData.accdb"
Dim sqlString As String = "Update Cridentials SET [Password] = @pass"
Dim pass As String = "SELECT [Password] from Cridentials"
Dim conn As New OleDbConnection(ConnString)
conn.open()
'this part is my problem
If (txtCOldPass.Text <> pass) Then
MsgBox("Wrong Old Password",MsgBoxStyle.Critical,"Password not matched")
ElseIf txtCOldPass.Text = nothing And txtCNewPass.Text = nothing And txtCConPass.Text = nothing Then
MsgBox("Please submit the following information","Incomplete")
ElseIf txtCNewPass.Text <> txtCConPass.Text Then
MsgBox("New Password and Confirm Password in not matached","Incomplete")
Else
Using con As New OleDbConnection(ConnString)
Using cmd As New OleDbCommand(sqlString,con)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("@pass",txtCNewPass.Text)
con.open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
MsgBox("Changing password Success!",MsgBoxStyle.information,"Successs!")
Me.Close()
Form1.Show()
End If
txtCOldPass.Focus()
txtCOldPass.Clear()
txtCNewPass.Clear()
txtCConPass.Clear()
End Sub
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。