If you receive this error while working within the Visual Studio environment and you are trying to append a record into an MS Access database, there could be a number of reasons that you are getting this error. The reason I was receiving this error and quite frankly a rather frustrating reason at that was because of one of my field names, password.
I should know better than to give database field names that are reserved words or potentially reserved words, but since I was creating this app anticipating newbie programmers would take it over, I wanted to be as descriptive and unambiguous as possible.
So anyway, the following insert statement in Visual Studio failed when I went to update my database.
INSERT INTO users (username, password, first_name, last_name) VALUES ('jd', 'turk', 'John', 'Dorian');
I received the error: Syntax error in INSERT INTO statement.
What needed to be done here is enclose the field name “password” in brackets []. So the statement should read:
INSERT INTO users (username, [password], first_name, last_name) VALUES ('jd', 'turk', 'John', 'Dorian');
Although the first query will work if you execute it within the MS Access environment, it will not work if you execute it within the code in your Visual Studio program.
Questions, comments and contributions are welcomed.
Thanks…It did solved my issue. I was using TimeStamp as my column name. Changing it solved my error.
You are my lucky star…
I have been worked out for 24hours to find out the problems…
Just because BRACKET!!!!