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

Recommended Answers

All 2 Replies

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.

yeah..tnx could u lean me ur book ? for sometime ? lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.