日期:2014-05-17 浏览次数:20677 次
public boolean isExists(String userName) { boolean ie = false; int result = 0; sql = "select count(*) as result from t_user where [user_name] = ?"; try { super.openConn(); pstmt = conn.prepareStatement(sql); pstmt.setString(1, userName); rs = pstmt.executeQuery(); if(rs.next()){ result = rs.getInt("result"); } if(result > 0){ ie = true; } } catch (Exception e) { e.printStackTrace(); }finally{ super.closeAll(); } return ie; }