小妹目前在做毕业设计,有很多不会的,在这里请教大家了.
String sql="select * from djcbb where jh='"+jNo+"'";
ResultSet rs=stmt.executeQuery(sql);
int countRecord=0;//记录条数
int countPageRecord=0;//每页记录条数
int countPage=0;//总页数
countPageRecord=8;//每页5条记录
rs.last();
countRecord=rs.getRow();
//得到总页数
if(countRecord/countPageRecord==0)
countPage=countRecord/countPageRecord;
else
countPage=countRecord/countPageRecord+1;
//把记录指针移至当前第一条记录之前
if((dipage-1)*countPageRecord==0)
rs.beforeFirst();
else
rs.absolute((dipage-1)*countPageRecord);
out.print("<Table Border style='font-size: 10pt'>");
out.print("<tr>");
out.print("<td width=60>"+"rq");
out.print("<td width=60>"+"jh");
out.print("<td width=60>"+"fybm");
out.print("<td width=60>"+"fymc");
out.print("<td width=60>"+"fyje");
out.print("<td width=60>"+"zrks");
out.print("</tr>");
int i=0;
while(rs.next())
{
out.print("<tr>");
out.print("<td>"+rs.getString("rq")+"</td>");
out.print("<td>"+rs.getString("jh")+"</td>");
out.print("<td>"+rs.getString("fybm")+"</td>");
out.print("<td>"+rs.getString("fymc")+"</td>");
out.print("<td>"+rs.getString("fyje")+"</td>");
out.print("<td>"+rs.getString("zrks")+"</td>");
out.print("</tr>");
i++;
if(i>=countPageRecord) break;//当前页显示完,则退出循环
}
out.print("<tr><td colspan=8 align=center>");
这是我代码中的一部分,可以分页显示一个六列的表,列名分别是rq,jh,fymc,fybm,fyje,zrks.怎么将这个结果导出到excel表中呢?
谢谢高手!小女子这厢有礼了!!!!
String sql="select * from djcbb where jh='"+jNo+"'";
ResultSet rs=stmt.executeQuery(sql);
int countRecord=0;//记录条数
int countPageRecord=0;//每页记录条数
int countPage=0;//总页数
countPageRecord=8;//每页5条记录
rs.last();
countRecord=rs.getRow();
//得到总页数
if(countRecord/countPageRecord==0)
countPage=countRecord/countPageRecord;
else
countPage=countRecord/countPageRecord+1;
//把记录指针移至当前第一条记录之前
if((dipage-1)*countPageRecord==0)
rs.beforeFirst();
else
rs.absolute((dipage-1)*countPageRecord);
out.print("<Table Border style='font-size: 10pt'>");
out.print("<tr>");
out.print("<td width=60>"+"rq");
out.print("<td width=60>"+"jh");
out.print("<td width=60>"+"fybm");
out.print("<td width=60>"+"fymc");
out.print("<td width=60>"+"fyje");
out.print("<td width=60>"+"zrks");
out.print("</tr>");
int i=0;
while(rs.next())
{
out.print("<tr>");
out.print("<td>"+rs.getString("rq")+"</td>");
out.print("<td>"+rs.getString("jh")+"</td>");
out.print("<td>"+rs.getString("fybm")+"</td>");
out.print("<td>"+rs.getString("fymc")+"</td>");
out.print("<td>"+rs.getString("fyje")+"</td>");
out.print("<td>"+rs.getString("zrks")+"</td>");
out.print("</tr>");
i++;
if(i>=countPageRecord) break;//当前页显示完,则退出循环
}
out.print("<tr><td colspan=8 align=center>");
这是我代码中的一部分,可以分页显示一个六列的表,列名分别是rq,jh,fymc,fybm,fyje,zrks.怎么将这个结果导出到excel表中呢?
谢谢高手!小女子这厢有礼了!!!!
参考