-1

i don't seem to understand why I keep on getting a syntax error whenever i do insert something. I do check my database and it's the exact name as well as my declaration in my designer form

con.ConnectionString = dbcon

    con.Open()

    sql1 = "Insert Into Order(OrderDay,CustomerID,Quantity,Amount)"
    sql1 = sql1 + "Values ('" & DateTimePicker1.Text & "','" & cmbCustomer.Text & "',
    '" & txtQty.Text & "','" & txtAmount.Text & "' )"

    adapt.InsertCommand = New OleDbCommand(sql1, con)
    adapt.InsertCommand.ExecuteNonQuery()

    MsgBox("record inserted")
    con.Close()

    con.Open()
3
  • 1
    Please provide us with the exact, complete, text of the error message. It points to exactly where the error is.
    – Rick James
    Jul 31 at 4:02
  • it always says syntax error in insert into statement but I check it multiple times already
    – Alexaucee
    Aug 1 at 10:21
  • What does the error message have after the word "near"?
    – Rick James
    Aug 1 at 16:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.