pendragon Posted December 16, 2004 Posted December 16, 2004 Hi all I am trying to insert a new record into my database and am getting an error that I don't seem to be able to find. The error is as follows. Syntax error in INSERT INTO Statement. My insert statement is INSERT INTO [CostDetail] (ProjectNumber, Type, Date, Reference, Amount, Comments, Locked, LockedBy) VALUES (?,?,?,?,?,?, false, 'No One') I can't see anything wrong with it. Is there any way to find out what the program things the error is? Thanks Quote
mike55 Posted December 16, 2004 Posted December 16, 2004 What is the exact error, can you give an example of the entire insert statement, including a set of values. Also what database are you using. You could always go to the data base and try and execute the statement directly with its proper values. Mike55 Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
EFileTahi-A Posted December 16, 2004 Posted December 16, 2004 (edited) Hi all I am trying to insert a new record into my database and am getting an error that I don't seem to be able to find. The error is as follows. Syntax error in INSERT INTO Statement. My insert statement is INSERT INTO [CostDetail] (ProjectNumber, Type, Date, Reference, Amount, Comments, Locked, LockedBy) VALUES (?,?,?,?,?,?, false, 'No One') I can't see anything wrong with it. Is there any way to find out what the program things the error is? Thanks Hi, 1 - make sure that you have the necessary quotes ('') on the string typed fields. (is not your "comments" field on the Data Base a text based field?) 2 - Make sure that your field names do not have the same name of an SQL internal keyword. (Just a few hours ago I had a field named "user" and I was always getting an sintaxe error, then, I realise that "user" was an internal ckeyword of the SQL language. So, I was forced to change the field name to something else to solve the problem) 3 - When I get sintaxe problems I also start by eliminate field by field until I realize which one is trigering the error. Hope it helps Edited December 16, 2004 by EFileTahi-A Quote
Rothariger Posted December 16, 2004 Posted December 16, 2004 enclose the fields name by [] and the problem is solved... i think that EFileTahi-A its right, and the DATE field is the problem... Quote
pendragon Posted December 20, 2004 Author Posted December 20, 2004 Thank you for your replys You are quite right the Date field was the problem, change the name and all works ok. Think I will now go and re-read my SQL key words list, hopefully it will sink in this time :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.