LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update query using "execute query"

Good day,
 
I'm trying to perform an update query from LV 7.1.  The only way I could think of to try to execute such a task would be with the Execute Query VI.  My SQL statement has the following form: (I changed the names/values due do confidentiality restraints):
 
UPDATE TableName SET 154.000000 WHERE Model = ABC123-DE45
 
I get the following error (again, my VI name changed for confidentiality):
 
Conn Execute.vi->LV-Program.vi<ERR>Exception occured in Microsoft OLE DB Provider for ODBC Drivers, [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement..  in Conn Execute.vi->LV-Program.vi
 
With this error code: -2147217900
 
Now I'm somewhat a novice at DB's and SQL so don't know specifically where the syntax error exists but this is what I've done thus far to troubleshoot:
 
As the model number has a dash in it (or a minus sign if you will), I've tried putting it in both quotations and appostrophies (ie value = "xxx-y" and value = 'xxx-y').  I tried both with and without a semicolon at the end of the string input for the query.  Get the same errors.
 
I'm trying to perform this update query to a local MDB, which is not set to read-only (according to the file->properties).  I also have full control permissions to this file.
 
I can successfully query the DB elsewhere in my program and am confident my DSN file containing the database info is fine.
 
 
 
Any help would as always be most appreciated
 
--
Sean
0 Kudos
Message 1 of 5
(3,472 Views)

The correct syntax for update is:

UPDATE tablename SET columnname = value WHERE columnname = value

So, you have the syntax error in the set.

0 Kudos
Message 2 of 5
(3,468 Views)

Hahaha,

Geeze.  You know I stared at it for a little longer than I'd like to admit, and of course I missed the obvious.  Thanks a bunch for your help.

0 Kudos
Message 3 of 5
(3,465 Views)
Ok, back to the query... having come back to this project, I find when executing this query on a replicable database, I'm getting the following error.  (LV 7.1, MSAccess 97 SR2)
 
Conn Execute.vi->APU-RTS4.vi<ERR>Exception occured in Microsoft OLE DB Provider for ODBC Drivers, [Microsoft][ODBC Microsoft Access Driver] Operation not supported on replicable databases that have not been converted to the current version..  in Conn Execute.vi->APU-RTS4.vi
 
Don't fully understand the error.  Newest version of what?
 
--
Sean
0 Kudos
Message 4 of 5
(3,421 Views)
My guess is the current version of your master but I seldom use Access and have never done anything with replication. Since this is an error generated by the ms driver, you might want to check microsoft's web site for the error message.
0 Kudos
Message 5 of 5
(3,416 Views)