jComboBox4 = new javax.swing.JComboBox<>();
try{
DBhepler db = new DBhepler();
String sql = "SELECT DISTINCT year from jxpj";
ResultSet rs =db.Search(sql, null);//将获取的年份放入数据集
ResultSetMetaData rsmd = null;//获取 列信息
rsmd = rs.getMetaData();
int count=rsmd.getColumnCount();//获取列数
//jComboBox4.addItem("年份");
while(rs.next()){
for(int i = 1;i<=count;i++){
jComboBox4.addItem(rs.getNString(i));
}
}
} catch (SQLException ex) {
Logger.getLogger(Frame_Show.class.getName()).log(Level.SEVERE, null, ex);
}
try{
DBhepler db = new DBhepler();
String sql = "SELECT DISTINCT year from jxpj";
ResultSet rs =db.Search(sql, null);//将获取的年份放入数据集
ResultSetMetaData rsmd = null;//获取 列信息
rsmd = rs.getMetaData();
int count=rsmd.getColumnCount();//获取列数
//jComboBox4.addItem("年份");
while(rs.next()){
for(int i = 1;i<=count;i++){
jComboBox4.addItem(rs.getNString(i));
}
}
} catch (SQLException ex) {
Logger.getLogger(Frame_Show.class.getName()).log(Level.SEVERE, null, ex);
}