hello i wanted to ask a question. Is it possible to put two ResultSet in one method and run it?
Basically this is which banking system and i need to run two ResultSet at the same time.
System.out.println(resultSet.getString(1));
double amount2 = resultSet.getDouble(1);
if (amount <= amount2) {
Statement s = connection.createStatement();
String query3 = "SELECT balance FROM Accounts WHERE id = '" + toAccount + "'";
ResultSet resultSet1 = preparedStatement.executeQuery(query3);
double amount4 = resultSet1.getDouble(1);
System.out.println("To user: " + amount4);
double amount5 = amount4 + amount;
String s2 = "UPDATE Accounts SET balance = '" + amount5 + "' WHERE id = '" + toAccount + "'";
double amount3 = amount2 - amount;
System.out.println("User balance: " + amount3);
String s1 = "UPDATE Accounts SET balance = '" + amount3 + "' WHERE id = '" + fromAccount + "'";
s.addBatch(s1);
s.addBatch(s2);
s.executeBatch();
Transactions transactions = new Transactions(fromAccount, toAccount, amount);
newTransaction(transactions);
question from:
https://stackoverflow.com/questions/66048837/is-it-possible-to-put-two-resultset-in-one-method-and-run-it 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…