Ray-Yan 2016-05-29 09:10 采纳率: 100%
浏览 1120
已采纳

应用程序开发时的数据库查询错误

图片说明
如上图所示,提示数据库出错,我查了代码半天也没找到错误,麻烦大家帮忙看下是什么原因,谢谢!
代码如下:

 public List queryBlank() throws Exception {
        int id = 1;
        List bs = new ArrayList();
        try {
            Connection conn=DBUtil.getConnection();
            String sql=" " +
                    "select (body,answer,exp,kwords,difficult,other,update_time) from blank ";
            PreparedStatement pstmt=conn.prepareStatement(sql);             
            ResultSet rs = pstmt.executeQuery(); //????出错行??
            while (rs.next()) {
                Blank b = new Blank();
                b.setBody(rs.getString("body"));
                b.setAnswer(rs.getString("answer"));
                b.setExplain(rs.getString("exp"));
                b.setKey(rs.getString("kwords"));
                b.setDifficults(rs.getString("difficult"));
                b.setOther(rs.getString("other"));
                b.setUpdate_time(rs.getDate("update_time"));
                bs.add(b);
            }
            return bs;
        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }
    }
  • 写回答

1条回答 默认 最新

  • 啥都不会的玩意儿 2016-05-29 09:28
    关注

    你的sql语句好奇怪,我没这么写过,好像不加括号吧?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?