resultset的怪问题!!在线等待!!!!!!!!!!!!!!!!!!!!高手来帮我咯

biscan212 2005-12-24 11:16:26
public Statement getStmtread() {
try {
con = getCon();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
return stmt;
} catch (Exception ex) {
System.err.println(ex.getMessage());
ex.printStackTrace();
}
return null;
}

public int getRowCount(String strSql) {
int intCount=0;
try{
stmt=getStmtread(); <---------#
rs=stmt.executeQuery("select count(*) from "+strSql);
if (rs.next())
intCount = rs.getInt(1); <---------*
}catch(Exception ex){
intCount=-2;
System.err.println("select count(*) from "+strSql);
System.err.println(ex.getMessage());
}finally{
close();
return intCount;
}
}

运行到*处,用watch观察rs.getInt(1)的值,出现exception occured in target VM
更奇怪的是,在#处在watch中观察rs.getInt(1),然后等到程序运行到*处,可以看到
rs.getInt(1)的值,但是此时在watch中再重新输入一次rs.getInt(1)就出现exception
occured in target VM。

真是搞不明白!!!
太奇怪了!!!
请高手指点!!
...全文
127 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
biscan212 2005-12-24
  • 打赏
  • 举报
回复
没人会吗?
biscan212 2005-12-24
  • 打赏
  • 举报
回复
有谁帮帮我

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧