SQL语法错误,但已从MYSQL复制

SQL语法错误,但已从MYSQL复制,mysql,sql,Mysql,Sql,我有一个从MYSQL复制的SQL查询,我删除了引号,但是,它似乎不起作用 conn = connect(); selectStatement = "UPDATE student SET Item ? = ?, Type ? = ? WHERE ID = ?"; System.out.println(selectStatement); if(conn != null) { pr

我有一个从MYSQL复制的SQL查询,我删除了引号,但是,它似乎不起作用

 conn = connect();
           selectStatement = "UPDATE student SET Item ? = ?, Type ? = ? WHERE ID = ?";
           System.out.println(selectStatement);
           if(conn != null)
           {
                preparedStatement = conn.prepareStatement(selectStatement);       
                preparedStatement.setString(2, id);
                preparedStatement.setInt(1, location);
                preparedStatement.setInt(3, location);
                preparedStatement.setString(4, type);
                preparedStatement.setString(5, userId);
                preparedStatement.executeUpdate();        
                return true;
我不确定它为什么不工作,因为抛出的异常是


com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以了解在第1行的“1=”sad“,Type 1=”asd',其中ID=”student1''附近使用的正确语法。最后,这一切都成功了

          conn = connect();
          selectStatement = "UPDATE student SET `Item " + location + "` = ? , `Type " + location + "` = ? WHERE ID = ?";
          System.out.println(selectStatement);
          if(conn != null)
          {
               preparedStatement = conn.prepareStatement(selectStatement);       
               preparedStatement.setString(1, id);
               preparedStatement.setString(2, type);
               preparedStatement.setString(3, userId);
               preparedStatement.executeUpdate();        
               return true;
          }

Sql语句应该是:selectStatement=“updatestudent SET Item=?,Type=?WHERE ID=?”;你能告诉我学生表中的列名是什么吗。这太奇怪了。一般来说,在列名中使用空格是个坏主意。请告诉我,
位置
类型
从未被用户输入过。我可以输入
=1的位置,其中0;辍学学生--