If I substitute some values and evaluate the first expression I get
UPDATE ptransaction SET Quantityt = 23, Partial_totalt='24' WHERE Product_Codet =CODE''AND soldtime = '2017-02-26 09:10:57'
You probably intended something like
UPDATE ptransaction SET Quantityt = 23, Partial_totalt=24 WHERE Product_Codet ='CODE' AND soldtime = '2017-02-26 09:10:57'
Check out the placement of your single quotes, especially after =CODE
which is followed by two single quotes. You can avoid the hassle of composing queries by using parameterized queries.