LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sql

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY,NAME,ADDRESS,PHONE) values (0,'moe','123 state','555-5555')' at line 1.  in Rec Create - Command.vi->Cmd Execute.vi->DB Tools Insert Data.vi->TEST-DB-GEO.vi
 
How can I get a syntax error if the ni supplied driver is doing all the work?
DB tools insert data.vi
 
Thanks.
 
gtb
0 Kudos
Message 1 of 5
(3,047 Views)

NI does not supply a "driver" but a wrapper for the ADO ActiveX object which allows you to talk to various kinds of DBs in windows through the same interface. I assume one of the values in your cluster is invalid (for example, if the key is automatic, you wouldn't need to enter it, although I don't know why it would return an error saying that the SQL syntax is invalid).

Another option is that maybe mySQL uses a slightly different SQL syntax, but it would sound unlikely that it should fail in something as simple as an insert operation. I suggest you post the relevant piece of code, or at least an image of it (no BMPs, please). Also, try probing inside the insert VI and look at the full SQL string being inserted into the Execute Query VI.


___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(3,040 Views)
I think you're right about the key field. If it's set to auto-generate, it's not a field that can be updated with an insert.
0 Kudos
Message 3 of 5
(3,030 Views)
Hi Gtb,
    a left-paren seems to be missing before 'KEY,
... though it's probably because the left-paren had been parsed before the error occurred...
 
Doing a lot with DBs myself, lately - please post the solution when you find it!
 
Cheers.

Message Edited by Dynamik on 01-23-2006 11:01 PM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 4 of 5
(3,024 Views)
Hi Gtb,
      Perhaps 'KEY' is a reserved word that shouldn't be used as a column name(?)
 
cheers.
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 5 of 5
(3,013 Views)