this doesn't work ( says java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''tb1' set 'name' = 'newName' where 'id' = 0000' at line ... ) >
String queryUpdate = "update ? set ? = ? where ? = ?";
preparedStmtUpdate.setString(1, "tb1");
preparedStmtUpdate.setString(2, "name");
preparedStmtUpdate.setString(3, "newName");
preparedStmtUpdate.setString(4, "id");
preparedStmtUpdate.setInt(5, 0000);
this does work >
String queryUpdate = "update tb1 set named = 'newName' where id = 0000";
then executing it >
PreparedStatement preparedStmtUpdate = con.prepareStatement(queryUpdate);
preparedStmtUpdate.executeUpdate();
Question: also why does it adds 'value' (quotes) when i try printing the PreparedStatement object? and why is it still adding it the error message?