Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Query has no results how do I tell that to a user in my program
    primarykey
    data
    text
    <p>I am building a program which checks the roles of users. When a button gets pressed it uses the userID to query the role/group table of our database. If a person is not in the role/group tables then they are a requester. I have the following code, and was wondering why the last <code>else if</code> statement is not working.</p> <p>When we set a person to be a requester, they are literally removed from the role/group tables. So the <code>resultset</code> should be empty. Right?</p> <pre><code>ResultSet rs = stmt.executeQuery(getRolesQuery2.toString()); try { boolean empty = true; while (rs.next()) { empty = false; userRole = rs.getInt(1); userGroup = rs.getInt(2); System.out.println("The Users Current Role/Group is: " +userRole+ "/" +userGroup); if(userRole == 4 &amp;&amp; userGroup == 1) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " NDS Administrator"); } else if(userRole == 1 &amp;&amp; userGroup == 3) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " Privacy Administrator"); } else if(userRole == 1 &amp;&amp; userGroup == 5) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " Security Administrator"); } else if(userRole == 1 &amp;&amp; userGroup == 7) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " ORD Administrator"); } else if(userRole == 1 &amp;&amp; userGroup == 9) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " OEF-OIF Administrator"); } else if(userRole == 1 &amp;&amp; userGroup == 11) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " Surgery Administrator"); } else if(userRole == 1 &amp;&amp; userGroup == 13) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " Capri Administrator"); } else if(userRole == 3 &amp;&amp; userGroup == 15) { userRoleLbl.setText("The User Role/Group is: " +userRole+ "/" +userGroup+ " DART Super User"); } //TODO: Add some handling for if the role/group is not present which means they are a requester else if(empty) { userRoleLbl.setText("The User is a Requester"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload