Solved sql query update ... Error: near "SET": syntax error ... not find it.
-
In a component I have these function ... it work, but when close my app, these function is call again (i have an other one very similar that send no error) and the application output show me these error:
qrc:filexxxx:335 : Error: near "SET": syntax error impoossible to execute the command (one error for every component istance, i reuse the component 4 time ... so 4 error like these. 335 is exactly the row that contains UPDATE command)
property string nameChartPage: nameChartPage property var settingDataStrPro:[] function myfunc() { db.transaction( function(tx1) { tx1.executeSql('UPDATE ' + nameChartPage + ' SET swA0=?, swA1=?, swA2=?, swA3=?, swA4=?, swA5=?, swA6=?, swA7=?, swA8=?, swA9=? WHERE idx=1', [ settingDataStrPro[0], settingDataStrPro[1], settingDataStrPro[2], settingDataStrPro[3], settingDataStrPro[4], settingDataStrPro[5], settingDataStrPro[6], settingDataStrPro[7], settingDataStrPro[8], settingDataStrPro[9] ]); } ) } console.log(settingDataStrPro)
Not know why I have these error. Console show me exactly 10 string (0 to 9). If scan database with a browser, all seems ok. Exist idx=1 and the column value is changed. Ok the table contains more than 10 column ... but i try to UPDATE entire row the error not disappear!!
-
@gfxx
Since you say you getError: near "SET": syntax error
show us exactly what
nameChartPage
is at the instant this line is executed, prove it by echoing the whole line before sending to SQL. -
@JonB so I control nameChartPage.lenght .... I use these query at desruption of my app page .... the query is call 2 time (not by myself but from my some error in code I supposed) .... the second time it is = 0 .... so query is for sure in error!!!!