Hi,
this is an update query ...
const stato2 = "F";
msg.topic = "UPDATE ListaSpesa SET Stato = '" + stato2 + "' WHERE Prodotto = 'Beer'"
and it works fine ....
but if I need to set with a variable (string) the condition Where, how it will be the query?
const stato2 = "F";
const prodotto = "Beer";
msg.topic = "UPDATE ListaSpesa SET Stato = '" + stato2 + "' WHERE Prodotto = ?????
I couldn't do it ....
const stato2 = "F";
const prodotto = "Beer";
msg.topic = "UPDATE ListaSpesa SET Stato = '" + stato2 + "' WHERE Prodotto = '" + prodotto + "'"
should work
Or
You could use string template
msg.topic = `UPDATE ListaSpesa SET Stato = '${stato2}' WHERE Prodotto = '${prodotto}'`
1 Like
Works!
Thank you, thank you very much ....
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.