0

クエリは次のようになります。

string query = "IF NOT EXISTS(
 SELECT * from clienti 
 where CodCliente=  ' " + id + " ' 
 AND NomeCliente= ' " + emri + " ' 
 AND RagioneSociale=' " + ragSoc + " ' 
 AND PartitaIVA=' " + piva + " ') 

Insert INTO clienti VALUES(
 ' " + id + 
 " ',' " + emri + 
 " ',' " + ragSoc + 
 " ',' " + piva + " ') 
 else 
  UPDATE clienti 
  SET(' " + id + " ',' " + emri + " ',' " + ragSoc + " ',' " + piva + " ')";

以下に示す同じ問題が発生し続けます。

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 'IF NOT EXISTS(SELECT * from clienti where CodCliente= ' 1 ' AND NomeCliente= ' ' at line 1

4

2 に答える 2

0

THENandEND IFキーワードが欠落していると思います。mysql のマニュアルを確認する

IF search_condition THEN statement_list
    [ELSEIF search_condition THEN statement_list] ...
    [ELSE statement_list]
END IF
于 2013-04-19T19:58:44.733 に答える