TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG-DEVEL:224] error



Erick Stohr wrote:
> 
> Anyone familiar with this error?
> 
> java.sql.SQLException: Before start of result set
>  at org.gjt.mm.mysql.ResultSet.checkRowPos(ResultSet.java)
>  at org.gjt.mm.mysql.ResultSet.getString(ResultSet.java)
>  at org.gjt.mm.mysql.ResultSet.getString(ResultSet.java)
> 
> I get it when I first try to pull Strings from teh result set.
> If code is needed I can provide, but I am basically looking for what is
> means. Is my row off somehow? I am pulling 3 things from 3 different
> tables in 1 query. I am not doing an <ResultSet>.next(), do I need to?
> Thanks.

Yes, next() positions the pointer/cursor the next position in the result
set.  If no next is done, the pointer is set to a position before the
first row, a null row if you will.  If you know it should return one and
only one row, you can do this:

if (t_resultSet.next) {
  do something;
}

or if multiple rows, then

while (t_resultSet.next()) {
  do something;
}

-- 
Perry Hoekstra

---
"I don't see much sense in that," said Rabbit. 
"No," said Pooh humbly, "there isn't. But there was going to be when I
began it. It's just that something happened to it along the way."