damaxy
May 20, 2009, 04:47 AM
hello! i have a code as shown below..the problem is, the code adding new user is working fine but the code for changing password will not work..it give error..i need help??? somebody?? thanks in advanced..
Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update.Click
Dim connection As New OleDbConnection(My.Settings.ConnectionString)
Dim cmd As New OleDbCommand
cmd.Connection = connection
cmd.Connection.Open()
cmd.CommandText = "Update Users set User_Name='" & TextBox1.Text & "',Password='" & TextBox2.Text & "'where User_Name='" & TextBox1.Text & "'"
cmd.ExecuteNonQuery()
End Sub
End Class
Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
Dim connection As New OleDbConnection(My.Settings.ConnectionString)
Dim com As New OleDbCommand
com.Connection = connection
com.Connection.Open()
com.CommandText = "Insert into Users values('" & TextBox1.Text & "','" & TextBox2.Text & "')"
com.ExecuteNonQuery()
MsgBox("User Created Successfully....")
End Sub
Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update.Click
Dim connection As New OleDbConnection(My.Settings.ConnectionString)
Dim cmd As New OleDbCommand
cmd.Connection = connection
cmd.Connection.Open()
cmd.CommandText = "Update Users set User_Name='" & TextBox1.Text & "',Password='" & TextBox2.Text & "'where User_Name='" & TextBox1.Text & "'"
cmd.ExecuteNonQuery()
End Sub
End Class
Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
Dim connection As New OleDbConnection(My.Settings.ConnectionString)
Dim com As New OleDbCommand
com.Connection = connection
com.Connection.Open()
com.CommandText = "Insert into Users values('" & TextBox1.Text & "','" & TextBox2.Text & "')"
com.ExecuteNonQuery()
MsgBox("User Created Successfully....")
End Sub





