heads=new Vector(); ResultSetMetaData rsmd=rs.getMetaData();//rs为查询结果集 int count=rsmd.getColumnCount(); for(int i=1;i<=count;i++){ heads.add(rsmd.getColumnName(i));//把列名存入向量heads中 }