public void updateClientsMoney(String name, String password, Long transactValue) throws SQLException {
System.out.println("updateClientsMoney");
String query = "";
if(transactValue < 0) {
query = String.format("UPDATE bank_client SET money %s where name = '%s'", transactValue, name);
} else{
query = String.format("UPDATE bank_client SET money %s where name = '%s'", transactValue, name);
}
try(Statement statement = connection.createStatement()){
statement.executeQuery(query);
}
}
但是会引发异常:“ java.sql.SQLException:无法使用executeQuery()发出数据操作语句”。公共无效updateClientsMoney(字符串名称,字符串密码,长transactValue)...