Java统计数据库表中记录数

public static int count(String txyl_table) {// 获取用户数量
int i = 0;// Store_Information
Connection con = DB.getConnnection();
try {
Statement stmt = con.createStatement();
ResultSet rset = stmt.executeQuery("select count(*)as totalCount from "+ txyl_table);
if(rset.next()) {
i=rset .getInt("totalCount");
}
} catch (Exception e) {
System.err.println("你确定你没有输错表明么???");
e.printStackTrace();
} finally {
DB.closeConn(con);
}
System.out.println(i);
return i;
}

  

上一篇:无法分配超出32(XXX)的MINEXTENTS报错的解决方法


下一篇:UVA 10453 十七 Make Palindrome