摘要:
StringBuffer sb_Sql=new StringBuffer("select * from t_bookType");sb_Sql.append(" and bookTypeName like '%"+search_BookTypeName+"%'");对于上面的代码,比较简单,但是有个容易疏漏的问题,往往会造成大问题。比如第二个括号中的and前边容易丢掉空格,造成出错。 阅读全文
摘要:
/*返回按条件的搜索*/public ResultSet getBookTypeList(Connection con,BookType bookType) throws Exception {StringBuffer sb_Sql=new StringBuffer("select * from t_bookType");String search_BookTypeName=bookType.getBookTypeName();if(StringUtil.isEmpty(search_BookTypeName)==false){sb_Sql.append(" an 阅读全文
摘要:
DefaultTableModelSwing填充表格的类DefaultTableModel dtm = (DefaultTableModel) bookTypeTable.getModel();dtm.setRowCount(0);Connection con = null;try {con = dbUtil.getCon();ResultSet rs = bookTypeDao.getBookTypeList(con,bookType);while (rs.next()) {Vector v = new Vector();v.add(rs.getInt("id"));v. 阅读全文