这个SQL查询有什么问题吗?

时间:2010-01-27 23:02:56

标签: mysql mysql-error-1064 labview

我正在使用LabVIEW和Database Toolkit来执行SQL查询,并且出于语法原因,它仍在对此进行调查。我通过ODBC连接器使用MySQL。除了最后一行之外,每一行的末尾都应该有一个换行符。

LabVIEW抛出的错误是:

可能的原因:

  

ADO错误:0x80040E14异常   在Microsoft OLE DB提供程序中出现   for ODBC Drivers:[MySQL] [ODBC 5.1   驱动程序]的[mysqld-42年5月1日社区]你   您的SQL语法有错误;   检查对应的手册   您的MySQL服务器版本   正确的语法在'UPDATE附近使用   plc_addresses SET CurrValue ='0.00'   地址='1092';更新plc_a'   在第2行   NI_Database_API.lvlib:康恩   Execute.vi-> UpdatePLCAddressesTable.vi-> DevelopSQL.vi

UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1132';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1092';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1103';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1105';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1161';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1167';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1129';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1088';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1098';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1099';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1100';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1117';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1118';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1106';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1107';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1108';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1109';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1110';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1111';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1151';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1154';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1157';
UPDATE plc_addresses SET CurrValue = '-1023.75' WHERE Address = '1119';
UPDATE plc_addresses SET CurrValue = '-1023.75' WHERE Address = '1120';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1165';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1095';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1164';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1096';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1097';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1121';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1122';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1123';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1124';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1089';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1101';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1112';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1113';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1114';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1115';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1116';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1091';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1141';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1142';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1143';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1139';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1153';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1148';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1145';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1150';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1147';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1149';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1146';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1104';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1093';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1125';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1126';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1127';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1094';
UPDATE plc_addresses SET CurrValue = '0.00' WHERE Address = '1114';
UPDATE plc_addresses SET CurrValue = '-2522.00' WHERE Address = '1114';


4 个答案:

答案 0 :(得分:3)

我认为您需要将这些作为单独的SQL语句发送,而不是一次发送所有这些语句。

答案 1 :(得分:1)

ADO不支持在单个操作中执行多个语句,您需要依次逐个执行它们。鉴于它们都很相似,您可能希望使用Prepared Statements

答案 2 :(得分:0)

根据Mimer Validator,您的SQL很好。我的猜测是,出于某种原因,它不喜欢分号。

答案 3 :(得分:0)