| Author |
ResultSet
|
lape show
Greenhorn
Joined: Feb 07, 2010
Posts: 6
|
|
Please how can i get the number of rows returned by a resultset. i need to pass data retrieved from SQL into an array then to the table model and finally to the jtable, but i need to know the size of the array.
|
lape
|
 |
Brian Enochson
Greenhorn
Joined: Apr 12, 2011
Posts: 14
|
|
This has been covered. http://www.coderanch.com/t/303346/JDBC/java/find-number-rows-resultset.
What you can also do is a select count with an identical where clause to your where used for the actual select?
Lastly, instead of using an array where you need to allocate it, add your results from your result set to an ArrayList as it will grow dynamically.
Brian
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
. . . and welcome to the Ranch, both of you
|
 |
lape show
Greenhorn
Joined: Feb 07, 2010
Posts: 6
|
|
Thanks a bunch!!!
|
 |
Brian Enochson
Greenhorn
Joined: Apr 12, 2011
Posts: 14
|
|
|
Thank you.
|
 |
 |
|
|
subject: ResultSet
|
|
|