How to update with dynamic variable?
We all know that the statement used to update the database using (JDBC with mysql) looks like this:
"assume the table name is NODES and the fields to be updated are value1 and value2"
now assume that I have this variable defined in my java program:
statement.executeUpdate("update NODES set value1='101', value2='110' where index='30'");
how can I put it in value1 or value2, I tried to put it using this statement but I get an error:
java.sql.SQLException: Unknown column 'var' in 'field list'
statement.executeUpdate("update NODES set value1=var, value2='110' where index='30'");