Recently I was working on a client’s project in C# with MS Access database. I usually don’t work on windows-only tools so it was somewhat of a learning experience. Anyways, while working on the project, we got stuck on a query.
It was an INSERT query which was running perfectly fine in Access, but when executed through C# it gave syntax error. Values were populating just fine, quotes were in right places but it continued to give syntax error, while copying it and running it in Access worked fine. After wasting couple of hours, we finally found out that problem was with fieldnames, apparently one of the fieldname was causing some problem, and we had to enclose each field name in square brackets [] to make them work.
So, if you are stuck in such a situation, try enclosing fieldnames in square brackets, actually it is usually considered a good practice to always enclose fieldnames in square brackets in MS Access queries.