Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

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)

Posted (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 by EFileTahi-A
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...