Friday, May 24, 2013

java.sql.SQLException: Before start of result set


Sqlite似乎沒有此問題 直接用result 是可以的
但是Porting到mysql  之後就一定要先run一下result.next()
花了一兩個小時才解了此問題~希望對大家有幫助!

#Problem:
java.sql.SQLException: Before start of result set


#Ans:
http://tutorials.jenkov.com/jdbc/resultset.html


Here is an example of iterating a ResultSet using the next() method:
while(result.next()) {
    // ... get column values from this record
}
As you can see, the next() method is actually called before the first record is accessed. That means, that the ResultSet starts out pointing before the first record. Once next() has been called once, it points at the first record.


No comments:

Post a Comment