try{
Connection conn = getConnection();
String strUpdateQuery = "update payment_table set CREDIT_CARD_NO = ? where PAYMENT_KEY= ?";
PreparedStatement ps =conn.prepareStatement(strUpdateQuery);
for(int i=0;i<nodes.getLength();i++){
ps.setString(1,"524364OQNBQQ4291");
ps.setString(2,"20130215123757533280168");
ps.executeUpdate();
conn.commit();
}
}catch(SQLException e){
e.printStackTrace();
}
即使在檢查主鍵後,即使是單個行也沒有更新是正確的。JDBC - PreparedStatement executeUpdate()返回0
是否缺少的BeginTransaction? –
另外,爲什麼循環? –
你想用你的頭銜傳達什麼?這似乎與你的實際問題無關。 –