LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute SQL syntax error

Hi, I am positive I am just overlooking some small bracket or parathesis here, but whatever I seem to try I always get a syntax error conserning my INSERT INTO statement. I have read through various manuals and tried multiple things. I have attached a pic of my most recent attempt of code if that helps at all. The two index statements are refering to the two parts of my array that I am trying to put into an access table. The first referenced at (item count,0) is Product ID and the second at (item count,1) is Quantity. Thanks.
0 Kudos
Message 1 of 7
(3,996 Views)
I had to dig up my old copy of the SQL Toolkit. You've got a couple of errors. You shouldn't use the square brackets ([ and ]) to enclose the column names. Use parantheses like the Values. And you should surround a text value with single quotes (') instead of double (").

Also, please don't post bmp files. They take way to long to download. Save them as jpg or png. MS Paint allows for jpg saves. And, looking at an image of your diagram is hard to tell where you have the wires going on the concantanate string function. If you still have problems, post the VI because you could still have problems there.
Message 2 of 7
(3,984 Views)
Thanks putting the single quotes worked and progressed me to my next error. Now it says I have a Query error. I have attached the VI so help yourself and sorry about the bitmap. Thank you again for your help.
0 Kudos
Message 3 of 7
(3,984 Views)
Ignore my above attachment I attached the not so complete version. Hopefully you will read this before wasting your time with the above.
0 Kudos
Message 4 of 7
(3,976 Views)
You've still got the double quote around the value i.e. "INSERT INTO 'Order list' (Product ID, Quantity) VALUES ("example", 1). It should be INSERT INTO 'Order list' (Product ID, Quantity) VALUES ('example', 1). I'm not sure though about how to surround the table name. You put a single quote around Order List and that may be correct. I've never used a table name with spaces in it. You could try it with the single and double quote or change the table name to OrderList. Access is a little weird though. I use SQL Server which is a lot more robust and obeys the SQL syntax better. One of the things that you can do in Access though is turn on SQL display. I think this was done in the query and selecting SQL VIEW from the View menu.
Message 5 of 7
(3,972 Views)
I am stumped. Thanks for your help Dennis. You need single quotes around any string value and table name. I have posted my code, it has a Query Syntax error and I have no idea what that means. So if you or anyone has any ideas, they are needed.

Message Edited by dave2 on 06-22-2005 07:30 AM

0 Kudos
Message 6 of 7
(3,961 Views)
I did some experiments with table names and columns with spaces in them. The correct syntax for your database is INSERT INTO "Order List" ("Product ID", Quantity) VALUES ('example', 3). So, surround the table name with a double quotes ("), and the text value with a single quote (').

Aslo, the SQL Toolkit that you're using is pretty old and no longer supported by NI (for that matter, so is your version 6 of LabVIEW). The newer Database Connectivity Toolkit is easier to use. You don't have to know SQL to use it in a lot of cases.
Message 7 of 7
(3,953 Views)