0

Sorry, I tried many times to figure out where the problem is and I found nothing, the error I get is "syntax error in update statement".

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    Dim pos As Integer = BindingContext(clientsDT).Position
    With clientsDT.Rows(pos)
        .Item("Client_ID") = Client_IDTextBox.Text
        .Item("Company_name") = Company_nameTextBox.Text
        .Item("Address") = AddressTextBox.Text
        .Item("City") = CityTextBox.Text
        .Item("Personnel") = PersonnelTextBox.Text
        .Item("Personnel_Gender") = Personnel_GenderComboBox.Text
        .Item("Personnel_Phone") = Personnel_PhoneTextBox.Text
        .Item("Client_Value") = Client_ValueTextBox.Text
        .Item("Client_Added by") = Added_byTextBox.Text
        .Item("Date_added") = Date_AddedDateTimePicker.Value
        .Item("Time_added") = Time_AddedDateTimePicker.Value
    End With
    Try
        Dim save As New OleDbCommandBuilder(clientsDA)
        clientsDA.Update(clientsDT)
        clientsDT.AcceptChanges()
        MsgBox("Data Saved Successfully")
        load_clients()
    Catch ex As Exception
        MessageBox.Show(ex.ToString)
    End Try
End Sub

this error I get whenever I tried to manipulate the database whether by updating or adding new data. please find attached, the error I always get exception error

the second error

4
  • the second error looks like the result of letting the user set/pick the ID. how can they know what to enter in Client_IDTextBox Commented Jun 3, 2016 at 18:21
  • @Plutonix that's pretty good !! Thanks a lot !! I guess i found where the problem is !!! Commented Jun 3, 2016 at 18:23
  • If it is an AI number, let the database assign it since that is its job Commented Jun 3, 2016 at 18:24
  • @Plutonix it is, yes you guided me to the right way!! Thanks a lot !! Appreciate your great help! Commented Jun 3, 2016 at 18:26

1 Answer 1

0

I'm going to hazard a guess that it's the space in the field name on this line:

.Item("Client_Added by") = Added_byTextBox.Text
Sign up to request clarification or add additional context in comments.

1 Comment

actually i added another error, i always get, could you please check it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.