日期:2014-05-18  浏览次数:20674 次

用数据集组装成一张表怎样写?
记录有6条,要求表4例,这样表示行是2行

java.lang.String   sql,sqlrow;  
java.sql.ResultSet   rs,rsrow;  
i=0;
sql   =   "select   count(*)   as   A   from   sort ";  
rs   =   sqlconn.executeQuery(sql);  
sqlrow   =   "select   *     from   sort   order   by   sortid ";  
rsrow   =   sqlconn.executeQuery(sqlrow);  

while   (rs.next())   {
rol=rs.getInt( "A ");
}
out.println(rol);
j=1;
out.println( " <table   border= '1 '   cellspacing= '1 '   cellpadding= '1 '   > ");
for   (i=1;i <=rol/4+1;i++){
out.println( " <tr> ");                    
out.println( " <td   align= 'center '   width= '20% '> ");
out.println(rsrow.getString( "images1 "));
out.println( " </tr> ");
}    
out.println( " </table> ");

不知道怎样写才能达到要求??请高手帮我看看。

------解决方案--------------------