尝试这些:
tx.executeSql(“SELECT * FROM Animal_Traits WHERE animalName LIKE%?%或trait LIKE%?%ORDER BY animalName”,[searchValue,searchValue],
有了这个,我被告知语法在%符号上中断...所以如果我试试这个:
tx.executeSql(“SELECT * FROM Animal_Traits WHERE animalName LIKE'%'?'%'或trait LIKE'%'?'%'ORDER BY animalName”,[searchValue,searchValue],
它告诉我语法中断?符号...(猜猜第一个?)如果我尝试这个:
tx.executeSql(“SELECT * FROM Animal_Traits WHERE animalName LIKE'%?%'或trait LIKE'%?%'ORDER BY animalName”,[searchValue,searchValue],
它告诉我参数的数量不匹配... grrr!
请有人帮助我。
谢谢!
答案 0 :(得分:2)
你需要这样做:
... WHERE animalName LIKE '%' || ? || '%' OR trait LIKE '%' || ? || '%'
||
是字符串连接符。问号应该在引号之外。