0

hi...i am a new user of vb.net and i want to have a code where changes in my existing data could be save when i click the button "update"...can anyone help me about this matter?...here's my code for the said matter...

Private Sub menu_update_Click(sender As Object, e As EventArgs) Handles menu_update.Click
        access = "UPDATE tbl_location WHERE locid = @locid SET locname = @locname, locadd = @locadd"

        con.Open()
        cmd = New OleDbCommand(access, con)

        cmd.Parameters.AddWithValue("@txt_locname", txt_locname)
        cmd.Parameters.AddWithValue("@txt_locadd", txt_locadd)
        cmd.ExecuteNonQuery()
        MsgBox("Successfully Updated...")
        con.Close()

        Me.menu_update.Enabled = False
        Me.menu_save.Enabled = False

        Me.txt_locname.Enabled = False
        Me.txt_locadd.Enabled = False

    End Sub

when i run the program, error appeared that there is an error in my update statement.

Edited by vbshad: private sub line is not encloses with the code

2
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by vbshad
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.