Question: Topic: Java Hello, I want to know how can I display All Transaction Statements based on the folllowing codes below: I need it urgely :(

Topic: Java

Hello, I want to know how can I display All Transaction Statements based on the folllowing codes below: I need it urgely :(

private static void genTransStmt() { Scanner input = new Scanner(System.in); System.out.println("\t\t\tTransaction Statement"); System.out.print("\tEnter Account Id : "); int id = input.nextInt(); input.nextLine(); try { stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * from Account where ACCNO = " + id); if (!rs.isBeforeFirst()) { System.out.println(" No such Account exists. "); } else { stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * from Transaction where ACCNO = " + id); while (rs.next()) { printTransDetails(rs.getInt(1), rs.getInt(2), rs.getString(3), rs.getDouble(4)); } } } catch (Exception e) { e.printStackTrace(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!