我无法在while循环中执行执行更新

时间:2015-04-20 15:17:39

标签: java

String re = "inCart";
String sre = "Sold";
resultSetP = statement.executeQuery("select * from shoppingcart where proStatus='" + re + "' and customerID='" + this.customerID + "'");
while (resultSet.next()) {
    int ed = statement.executeUpdate("update shoppingcart set proStatus='" + sre + "'  where proStatus='" + re + "' and customerID='" + this.customerID + "'");
}

resultSetS = statement.executeQuery("select * from shoppingcart where serStatus='" + re + "' and customerID='" + this.customerID + "'");
while (resultSet.next()) {
    int efd = statement.executeUpdate("update shoppingcart set serStatus='" + sre + "' where serStatus='" + re + "' and customerID='" + this.customerID + "'");
}

1 个答案:

答案 0 :(得分:0)

在您的代码中,您在循环条件 resultSet.next()中写入它可能应该是 resultSetS.next() resultSetP.next()< / em>的