Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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
Posted
Updated 18-Jun-14 0:30am
v4
Comments
ArunRajendra 18-Jun-14 6:03am    
Not working means?
p@y@l 18-Jun-14 6:23am    
Its not getting updated or deleted in the database.
Kornfeld Eliyahu Peter 18-Jun-14 6:26am    
Have any errors?
p@y@l 18-Jun-14 6:32am    
No errors.I have updated the code with success and error method.But it also doesn't show any message.
Kornfeld Eliyahu Peter 18-Jun-14 6:34am    
If there is a JavaScrip error (not a logical error) than browsers will 'break-down' in silence in most cases, that's the reason you have to debug it in the browser...

1 solution

Dear

Change below code :

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


replace with :
C#
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 :
C#
transaction.executeSql('DELETE * FROM allocation WHERE pay_number="p3"');



replace with :
C#
transaction.executeSql("DELETE FROM allocation WHERE pay_number='p3'");
OR 
transaction.executeSql('DELETE FROM allocation WHERE pay_number=\'p3\'');
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900