Topic: 求助ResultSet无法读取第一条记录(请看代码)

  Print this page

1.求助ResultSet无法读取第一条记录(请看代码) Copy to clipboard
Posted by: beingo
Posted on: 2004-11-02 19:50

while(result.next()) 
{

vectordata=new Vector();
vectordata.addElement(result.getString(1));
vectordata.addElement(result.getString(2));
vectordata.addElement(result.getString(3));
vectordata.addElement(result.getString(4));
vectordata.addElement(result.getString(5));
vectordata.addElement(result.getString(6));
vectordata.addElement(result.getString(7));

max.addElement(vectordata);

}

由于while时就使用了next所以使终无法读到第一条记录,请帮忙解决谢谢

2.Re:求助RsultSet无法读取第一条记录(请看代码) [Re: beingo] Copy to clipboard
Posted by: pathfinder
Posted on: 2004-11-02 19:56

刚才的回答错了。
看ResultSet的doc:
Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.
第一次调用next(),指向的就是第一个元素。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923