what's the problem with this ? any 1 can help me out..tnx in advance

   Dim filePath As String
            filePath = Application.StartupPath() & "\" & DBFile
            connection = New OleDb.OleDbConnection(ConnectionString & filePath)
            Dim command As OleDb.OleDbCommand = New OleDb.OleDbCommand
            command.Connection = connection

            '---set the user's particulars in the table---
            Dim sql As String = "UPDATE enroll SET username='" & TextBox1.Text & "', " & _
               " WHERE ID=" & _UserID
            command.CommandText = sql
            MsgBox("User added successfully!")
        Catch ex As Exception
        End Try

Edited 2 Years Ago by y0yie_333: i forgot to post my code..

Attachments error.jpg 84.23 KB

please check your update statement(i will start programming with database very soon but before right now , i am reading Book on SQL).
i saw there the correct syntax for update statement is:

UPDATE enroll SET username='" & textbox1.Text & "' where ID=" & _UserId

, is used when you are gonna update multiple fields.

Edited 2 Years Ago by Learner010

This question has already been answered. Start a new discussion instead.