不能 用表格显示数据
我写的一个JPanel 用一个表格显示数据 运行后 没有数据 只有表头 没有出现报错信息 请各位帮忙看看public void initBookTable(){
Vector v=new Vector();
DefaultTableModel dm;
String cc[]={"卡号","学号","姓名","专业","年级","余额","密码","挂失"};
String data[][]=new String[v.size()][cc.length];
String sql="select * from stu";
Connection conn=null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:mo","",""); }
catch (ClassNotFoundException e)
{e.printStackTrace();}
catch (SQLException e)
{e.printStackTrace();}
try{
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
for(int i=0;i<v.size();i++){
data[0]=rs.getString(1);
data[1]=rs.getString(2);
data[2]=rs.getString(3);
data[3]=rs.getString(4);
data[4]=rs.getString(5);
data[5]=rs.getString(6);
data[6]=rs.getString(7);
data[7]=rs.getString(8);
}
}
}catch(SQLException e0){
e0.printStackTrace();
}finally{
try{
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt=null;
}
if(conn!=null){
conn.close();
}
}catch(Exception e1){
e1.printStackTrace();
}
}
dm=new DefaultTableModel(data,cc);
jTable1.setModel(dm);
}