We can use getxxx to get the resultset's individual feild value, how can we use an array object to store a record (row) value? For example: resultset has 5 columns/fields and they have different data type. Can we do this: while (rs.next()) Object[][][][][]= { {rs.getObject(1)}, {rs.getObject(2)},...,{rs.getObject(50} } I think my syntax is wrong, can anyone give me some helps? Thanks! Mindy
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
Hi Mindy, Think about using vectors.
Once you have the vector filled you can use the method toArray to get an array of objects if you want (I really don't advise it though). Regards, Manfred.
Mindy Wu
Ranch Hand
Joined: Jan 12, 2001
Posts: 121
posted
0
Thanks Manfred, Can you tell me why shouldn't i use vector? Do you have any alternative methods to do that? After I copied the vector into an array, how can i access each element? Vector v = new Vector(numberOfRows); while( rsParameter.next() ) { v1 = new Vector(); for( int i = 0; i < 5; ++i ) { v1.addElement( rs.getObject( 1 ) ); } v.addElement( v1 ); } arrayPars = new String[v.size()]; v.copyInto(arrayPars);