誰能告訴我,爲什麼以下兩個SQL精簡版插入語句工作:爲什麼不會這個SQL精簡版插入statment工作
tx.executeSql("INSERT INTO EVENTS ('name','altId','time') VALUES (?,?,?)",["one", "two","three"]);
tx.executeSql("INSERT INTO EVENTS ('name','altId') VALUES (?,?)",[("one", "two"),("three", "four")]);
,但低於我想出了答案如下,以this question一個聲明:
tx.executeSql("INSERT INTO EVENTS ('name','altId','time') VALUES (?,?,?)",[("one", "two","three"),("four", "five","six")]);
拋出錯誤:「?」在聲明中串5號s不匹配參數計數
「不適用」對你來說意味着什麼? – laalto
它引發錯誤代碼:5(請參閱編輯) –
您已經指定了3列來插入,但只傳遞2個值......並且您可以使用err.message來獲取消息字符串。 –