Javascript-Update命令不起作用。 [英] Javascript-Update command not working.

查看:76
本文介绍了Javascript-Update命令不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 function deallocate()
{
db1 = openDatabase(databasename,version,displayName,maxSize);
db1.transaction(函数(事务)
{
var query = ' 从付款t1,发票t2中选择t1.cust_code,t2.cust_code,其中t1.cust_code = t2.cust_code';
transaction.executeSql(查询,[],函数(事务,结果)
{
transaction.executeSql(' 更新发票SET inv_amount_paid =?',[ 0 ]);
transaction.executeSql(' 更新付款SET amount_alloc =?其中pay_number =p3',[ 0 ]);
});
transaction.executeSql(' DELETE * FROM allocation WHERE pay_number =p3' );
},populate_success,transaction_error);
}





我的代码更新表中的某些行。它正在执行select命令并输入executeSql但是没有' t更新指定的行。上面的代码有什么问题..plzz help

解决方案

亲爱的



更改以下代码:



您的代码:

 transaction.executeSql(' 更新付款SET amount_alloc =?其中pay_number =p3',[ 0 ]); 





替换为:

交易.executeSql( 更新付款SET amount_alloc =?其中pay_number ='p3',[ 0 ]); 
OR
transaction.executeSql(' UPDATE payment SET amount_alloc =?其中pay_number = \' p3 \'',[ 0 ]);







你的代码:

 transaction.executeSql('  DELETE * FROM allocation WHERE pay_number =p3'); 







替换为:

 transaction.executeSql(  DELETE FROM allocation WHERE pay_number ='p3'); 
OR
transaction.executeSql(' DELETE FROM allocation WHERE pay_number = \'p3 \ '');


function deallocate()                                                       
{
            db1=openDatabase(databasename, version, displayName,maxSize);
            db1.transaction(function(transaction)
            {
               var query='Select t1.cust_code,t2.cust_code from payments t1,invoice t2 where t1.cust_code=t2.cust_code';
               transaction.executeSql(query, [] , function(transaction, result)
                {
                    transaction.executeSql('UPDATE invoice SET inv_amount_paid=?',[0]);
                    transaction.executeSql('UPDATE payments SET amount_alloc=? where pay_number="p3"',[0]);
                });
                   transaction.executeSql('DELETE * FROM allocation WHERE pay_number="p3"');
             },populate_success, transaction_error);
}



My code to update certain rows in tables.It is executing the select command and entering the executeSql but doesn't update the specified rows..What is wrong in the above code..plzz help

解决方案

Dear

Change below code :

your code :

transaction.executeSql('UPDATE payments SET amount_alloc=? where pay_number="p3"',[0]);



replace with :

transaction.executeSql("UPDATE payments SET amount_alloc=? where pay_number='p3'",[0]);
OR 
transaction.executeSql('UPDATE payments SET amount_alloc=? where pay_number=\'p3\'',[0]);




your code :

transaction.executeSql('DELETE * FROM allocation WHERE pay_number="p3"');




replace with :

transaction.executeSql("DELETE FROM allocation WHERE pay_number='p3'");
OR 
transaction.executeSql('DELETE FROM allocation WHERE pay_number=\'p3\'');


这篇关于Javascript-Update命令不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆