0

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

   Dim filePath As String
        Try
            filePath = Application.StartupPath() & "\" & DBFile
            connection = New OleDb.OleDbConnection(ConnectionString & filePath)
            connection.Open()
            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
            command.ExecuteNonQuery()
            MsgBox("User added successfully!")
            connection.Close()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

Edited by y0yie_333: i forgot to post my code..

Attachments error.jpg 84.23 KB
2
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by y0yie_333
0

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 by Learner010

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.