【发布时间】:2015-09-27 04:01:26
【问题描述】:
所以我试图从我的数据库中获取数据并将其放入 jTable。它可以正常工作,因为它显示了第一组结果,但它只是不断重复相同的记录。有人知道它有什么问题吗?提前致谢!
void Flight(){
try{
int x = 0;
while (rs.next()){
jTable1.setValueAt(flightID, x, 0);
jTable1.setValueAt(departdate, x, 1);
jTable1.setValueAt(departtime, x, 2);
jTable1.setValueAt(destination, x, 3);
jTable1.setValueAt(arrivdate, x, 4);
jTable1.setValueAt(arrivtime, x, 5);
x++;
rs.next();
}
}
catch(SQLException err) {
JOptionPane.showMessageDialog(AdminWindow.this, err.getMessage());
}
}
【问题讨论】: