Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String args[])
- {
- int count = 0;
- boolean status = false;
- //count = retrieveData(); Current code working but captures only 1 values at a time i.e. Count not the status
- /* Expected Code
- if (status == true) // where status and count is returned from retrieveData method
- {
- count = retrieveData();
- System.out.println("Status is true so can proceed");
- }
- else
- System.out.println("Status is not true so don't proceed");
- */
- }
- public static int retrieveData() throws Exception
- {
- boolean success = false;
- String query = "SELECT Count(1) FROM Account";
- int totalCount=0;
- ResultSet rsRetrieve = null;
- Statement stmt = null;
- stmt = conn.createStatement();
- rsRetrieve = stmt.executeQuery(query);
- while (rsRetrieve.next())
- {
- totalCount= rsRetrieve.getInt(1);
- System.out.println("totalCount : "+totalCount);
- }
- success = true;
- return totalCount; // current working code but returns only 1 value i.e. Count not status
- /* Expected
- return success + totalCount
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement