62,567
社区成员




try
{
c = DriverManager.getConnection( "jdbc:odbc:students", "","" );
sq1 = c.createStatement();
rs = sq1.executeQuery("select * from stu" );
int index=0;
WritableWorkbook book;
try {
book = Workbook.createWorkbook(new File("e:/atoecel.xls"));
WritableSheet sheet = book.createSheet("Sheet_1", 0);
while (rs.next())
{
s1 = rs.getString(1);
s2 = rs.getString(2);
s3 = rs.getString(3);
s4 = rs.getString(4);
Label label1 = new Label (0,index,s1);
sheet.addCell(label1);
Label label2 = new Label (1,index,s2);
sheet.addCell(label2);
Label label3 = new Label (2,index,s3);
sheet.addCell(label3);
Label label4 = new Label (3,index,s4);
sheet.addCell(label4);
book.write();
index++;
}
c.close();
book.close();
}
catch (Exception e)
{
}
}
catch (Exception ex)
{
}