Having a problem with my update code for a button to update the password :
Code:
Imports System.Data.SqlClient
Public Class FirstRun
Dim MyConnection As New SqlConnection
Dim MyCommand As New SqlCommand
Dim ra As Integer
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtAdminPass.Text = txtAdminPass2.Text Then
MyConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Login.mdf;Integrated Security=True;User Instance=True")
MyConnection.Open()
MyCommand = New SqlCommand("UPDATE UserPass SET Username = '" & txtAdminUser.Text & "', Password = '" & txtAdminPass.Text & "', WHERE ID = '1'", MyConnection)
ra = MyCommand.ExecuteNonQuery()
MsgBox("Your Password Have Been Changed!", MsgBoxStyle.Exclamation)
MyConnection.Close()
Else : MsgBox("The Passwords Do Not Match", MsgBoxStyle.Critical)
End If
End Sub