下面的sql语句怎么写才能让 pstmt.executeQuery();返回一个int类型,判断数据库里是否有这条记录

2025-04-03 14:55:28
推荐回答(1个)
回答1:

int i=0;
String sql = "select * from administrator whre name = ?;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, Name);
ResultSet re = pstmt .executeQuery();
while(re.next()){
i++;
}
if(i>0){
out.print(“该用户已经被注册”);

}