ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error when using UPDATE SQL command

Using DB Connectivity Toolkit, I am trying to execute the following SQL command:
 
UPDATE ItemTable SET KGU? = 'True' WHERE ProductID = 'S1'
 
I get this error:  "Conn Execute.vi<ERR>Incorrect function. in Conn Execute.vi"
 
Attached is a JPEG of the code.
 
Any help would be greatly appreciated.
 
Thanks,
Scott
 
0 Kudos
Message 1 of 11
(5,070 Views)
Try putting enclosing your column name KGU? in square brackets like
 
UPDATE ItemTable SET [KGU?] = 'True' WHERE ProductID = 'S1'
 
and see if that helps you.
 
David
 
 
0 Kudos
Message 2 of 11
(5,054 Views)
Try putting enclosing your column name KGU? in square brackets like
 
UPDATE ItemTable SET [KGU?] = 'True' WHERE ProductID = 'S1'
 
and see if that helps you.
 
David
0 Kudos
Message 3 of 11
(5,054 Views)

David,

 

Thanks for replying.  I tried the brackets around KGU?, it did not resolve the failure.  Any other ideas?

 

Thanks,

Scott

0 Kudos
Message 4 of 11
(5,048 Views)
Just had another look and you are missing a semi-colon to terminate the command
 
UPDATE ItemTable SET KGU? = 'True' WHERE ProductID = 'S1';
 
I would keep [KGU?] in just in case the SQL interpreter thinks the ? is an operator instead of being part of a field name.
0 Kudos
Message 5 of 11
(5,042 Views)

I tried the semicolon too ... same error message.

Scott

 

0 Kudos
Message 6 of 11
(5,038 Views)
Scott
 
Have you tried to run your UPDATE query in MS Access like this?
 
 
Open your database and create a new query in MS Access then change to SQL view and paste your query there. Then execute it and look at the errors, if any.
 
I always build design my queries in MS Access query builder then transfer the SQL to Labview where I then use format into string or the build text express vi to create variable queries.
 
Could you post your vi?
 
David

Message Edited by David Crawford on 04-27-2006 02:56 PM

0 Kudos
Message 7 of 11
(5,036 Views)

David,

It works now!!

I changed the KGU? field name to KGU and it worked!  I guess the ? was a problem. 

Thanks for your help.

Scott

 

0 Kudos
Message 8 of 11
(5,031 Views)

Brilliant, well done.

So was the field name in the database just "KGU" and not "KGU?" then?

David

0 Kudos
Message 9 of 11
(5,028 Views)

No the field in the database was really KGU?.  Adding the brackets [KGU?] appears not to "fix" the fact that there is a ? in the field name.

Scott

 

0 Kudos
Message 10 of 11
(5,025 Views)