Would you be that kind and tell me whats wrong in here? conn is DriverManager.getConnection(DB_URL)
try {
PreparedStatement prepStmt = conn.prepareStatement(
"UPDATE week SET ?=? WHERE id>=? AND id<=?");
prepStmt.setString(1, s);
prepStmt.setFloat(2, x);
prepStmt.setInt(3, c);
prepStmt.setInt(4, d);
prepStmt.executeUpdate();
} catch(SQLException e) {
System.err.println("Error during data update");
e.printStackTrace();
}
Error is in first line of "try" and it goes like "SQL error or missing database (near "?": syntax error)". I have to add that when I put this statement in cmd with "?" substituted with values it works as charm.
PreparedStatement prepStmt = conn.prepareStatement( "UPDATE week SET "+s+"=? WHERE id>=? AND id<=?");