count(*)只统计记录个数,
"select name from guestbook";
这样才能取出name。
"select name from guestbook";
这样才能取出name。
解决方案 »
- Myeclipse连接数据库,tomcat7.0.22,出错,急!
- 将对象类型转换成list问题??List<Goods> list = (List<Goods>) goods ??
- jsp在LINUX下的环境应该怎么搭建
- java.lang.NoSuchMethodError: jdyd.hotel.setPassword(Ljava/lang/String;)V
- 问个问题,谢谢回答?
- 求助,struts2的action配置问题
- 只要一句话!
- resin的服务器,为什么刷新几次就出现这种问题?
- 在JSP中销毁javabean对象,在线等待!
- 超级菜鸟问题,不要打我!一定要打的话,不要打脸!谢谢!-->如何在Tomcat中设置虚拟目录?
- 高手进来帮我看看为什么得不到blob对象?
- 文章的动态发布(图文混排)
try
{ResultSet countrs=null;
countrs=showBean.executeQuery("select count(*) as cnt from guestbook");
if(countrs.next())
totalRec=countrs.getInt("cnt");
countrs.close();
countrs=showBean.executeQuery("select [name] from guestbook");
if(countrs.next())
out.print(countrs.getString("name"));
countrs.close();
showBean.closeStmt();
}
catch(Exception e){
e.printStackTrace();
}
try
{ResultSet countrs=null;
countrs=showBean.executeQuery("select count(*) as cnt from guestbook");
if(countrs.next())
totalRec=countrs.getInt("cnt");
countrs.close();
countrs=showBean.executeQuery("select [name] from guestbook");
if(countrs.next())
out.print(countrs.getString("name"));
countrs.close();
showBean.closeStmt();
}
catch(Exception e){
e.printStackTrace();
}
try
{ResultSet countrs=null;
countrs=showBean.executeQuery("select count(*) as cnt from guestbook");
if(countrs.next())
totalRec=countrs.getInt("cnt");
countrs.close();
countrs=showBean.executeQuery("select [name] from guestbook");
if(countrs.next())
out.print(countrs.getString("name"));
countrs.close();
showBean.closeStmt();
}
catch(Exception e){
e.printStackTrace();
}