大海深处的星星 2015-12-23 08:03 采纳率: 100%
浏览 2067
已采纳

查询数据库报错,错误提示如下,代码如下

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 '? and sex=?' at line 1

图片

  • 写回答

4条回答 默认 最新

  • secoler 2015-12-23 08:29
    关注

    在执行 rs = pstat.executeQuery(sql); 之前  将sql打印出来,System.out.println(sql);

    然后把打印出来的sql 放在数据库里执行。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?