ResultSet.isFirst()咋就不好用???

rongcolt 2004-10-10 11:38:00
if(rs.isFirst()){}报错,为什么?
...全文
194 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
rongcolt 2004-10-10
  • 打赏
  • 举报
回复
谢谢shangqiao(伤桥)指点!合作与快!
DBTools()是我自己写的操作数据库的n个方法
lansb1 2004-10-10
  • 打赏
  • 举报
回复
what is DBTools()?
shangqiao 2004-10-10
  • 打赏
  • 举报
回复
public Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the createStatement method above, but it allows the default result set type and concurrency to be overridden.

Parameters:
resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
Returns:
a new Statement object that will generate ResultSet objects with the given type and concurrency
Throws:
SQLException - if a database access error occurs or the given parameters are not ResultSet constants indicating type and concurrency
Since:
1.2
要使ResultSet可以滚动,必须得到Statement设定参数
rongcolt 2004-10-10
  • 打赏
  • 举报
回复
try{
dbTools = new DBTools();
ResultSet chainRS=dbTools.getResultSet(getChainSql);
while(chainRS.next()){
iChainId = chainRS.getInt("chain_id");
sSourceCol = chainRS.getString("source_col");
sSourceColType = chainRS.getString("source_col_type");
sAimCol = chainRS.getString("aim_col");
sAimColType = chainRS.getString("aim_col_type");
//把数据链信息放入容器
if(chainRS.isLast()){
tempSelect = tempSelect+" "+sSourceCol; }
else{
tempSelect = tempSelect+" , "+sSourceCol;
}
}
catch(Exception e){
return -1;
}
sirfei 2004-10-10
  • 打赏
  • 举报
回复
conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
szpqq 2004-10-10
  • 打赏
  • 举报
回复
试试
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery(sql);

81,095

社区成员

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

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