A database operation problems

Category: Web Develop
2013-06-15 08:56:35

Sponsored Links
I query the database, get a ResultSet. I want to use this ResultSet ArrayList class encapsulates it. How can we package and how ResultSet in an ArrayList then taken out of the data in the table in jsp page is displayed.
in use ArrayList package, I use this method:

ArrayList ; aList = new ArrayList ();
ResultSetMetaData rsmd = qryResultSet.getMetaData ();
; while (qryResultSet.next ()) {
ArrayList array = new ArrayList ();
for (int i = 0; i <rsmd.getColumnCount () ; i + +) {
array.add (qryResultSet.getString (i +1));
aList.add (array );
I do not know array.add (qryResultSet.getString (i +1)); this Is there a problem statement, and if there is not a field qryResultSet String, is not it also possible, if not, there are other ways?

Sponsored Links

Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.