weixin_36605200
唐·吉坷德
2017-11-01 14:05

mysql问题,执行查询语句的时候出错

  • java
  • mysql

错误信息: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 '=null where borrowBookName=null' at line 1
方法:public ResultSet checkBorrowBook(Connection con,Borrow borrow) throws Exception{
String sql= "select * from t_borrow borrowBookAutor=? where borrowBookName=? ";
PreparedStatement psmt=con.prepareStatement(sql);
psmt.setString(1,borrow.getBookName());
psmt.setString(2,borrow.getBorrowBookAutor());
return psmt.executeQuery();
}

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答