Syntax error (Missing operator)

Katelynn7

New member
Joined
Mar 5, 2010
Messages
2
Location
Ohio
Programming Experience
Beginner
I have 15 fields setup with .mdb... the one that's giving me trouble is the "Notes" field. There are no extra characters and no spaces in the field names.

I'm having trouble adding the records. Here is the code:

VB.NET:
 Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
    Try
      Dim com As New OleDbCommand
      com.Connection = con
      txtAccountNumber.Focus()
      com.CommandText = "INSERT INTO Customers VALUES(" & txtAccountNumber.Text & _
      ",'" & txtMember.Text & "','" & txtSSN.Text & "','" & txtFirstName.Text & _
      "','" & txtMI.Text & "','" & txtLastName.Text & "','" & txtAddress1.Text & _
      "','" & txtAddress2.Text & "','" & txtCity.Text & "','" & cboState.Text & _
      "','" & txtZip.Text & "','" & txtPhone.Text & "','" & txtCell.Text & _
      "','" & txtFax.Text & "','" & txtEmail.Text & "'," & txtNotes.Text & ")"
      com.ExecuteNonQuery()
      MsgBox("Record Inserted!")
      KS_FillComboBox1()
      KS_Connect()
      KS_ClearAll()
    Catch exp As Exception
      MsgBox(exp.ToString())
    End Try
  End Sub

I've got a jpg with the error. I would appreciate any help. Thanks!
 

Attachments

  • Error.jpg
    Error.jpg
    43.3 KB · Views: 47
I can see where your problem is, but I am not going to tell you the answer. Instead, you should learn about the use of parameters - it will help you in the long term. Look at the link in my signature :)
 
Back
Top