jeudi 30 avril 2015

SQLite adding a numerical var to existing value in js

I have the following table

buildingcode buildingreceiptno buildingaddress buildingpay
1012         2                 address 1       0
1001         3                 address 2       0
1003         0                 address 3       0

I want to update buildingreceipt of a certain buildingcode by a numerical var

I use the following code but it does not work

t.executeSql('UPDATE buildings SET buildingpay = ?, buildingreceiptno = buildingreceiptno + numericalValue WHERE buildingaddress = ?', 
     [myrow.payamount.toFixed(2), myrow.buildingaddress]);

myrow.payamount.toFixed(2), myrow.buildingaddress are correct vars

Aucun commentaire:

Enregistrer un commentaire