好心的人近来看看,谢谢了
为什么我的程序 不能对表facilityhire的信息进行循环update呢,我用 System.out.println(fh_id);测试他输出有10个数,为什么当程序执行后他只对其中一个记录进行修改而已,为什么不全部修改,谢谢,程序在下面
Statement stmt = con.createStatement();
ResultSet rsHire = stmt.executeQuery("SELECT * FROM facilityhire");
while(rsHire.next())
{
if(rsHire.getString("fh_status").equalsIgnoreCase("WAITING"))
{
int fh_id=rsHire.getInt("fh_id");
System.out.println(fh_id);
String sql="UPDATE facilityhire SET fh_status='HIRING' WHERE fh_id="+fh_id;
stmt.executeUpdate(sql);
}
}