日期:2014-05-17 浏览次数:20777 次
//执行删除操作 public int delete(member m) { int ret = 0; try{ String sql = "delect from tb_member where ID=" + m.getID(); ret=conn.executeUpdate(sql); //这句没执行 没调用executeUpdate() ??? System.out.println("ret="+ret); } catch(Exception e) { ret=0; } conn.close(); return ret; }
public int executeUpdate(String sql) { int result = 0; try { conn = getConnection(); stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); result = stmt.executeUpdate(sql); } catch (SQLException ex) { result = 0; } try { stmt.close(); } catch (SQLException ex1) { } return result; }