Advertisement
Guest User

[JAVA E MYSQL] ERRO[Illegal operation on empty result set.]

a guest
Nov 29th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1.     public int[] getContas() throws Exception {
  2.         try {
  3.             int i = 0;
  4.             int[] nC = new int[2];
  5.             String comando = "SELECT * FROM sql597954.Conta where id_user = ?";
  6.             PreparedStatement ps = conectar.prepareStatement(comando);
  7.             ps.setString(1, String.valueOf(idUsuarioLogado));
  8.             ResultSet rs = ps.executeQuery();
  9.             while(rs.next()){
  10.             nC[i] = rs.getInt("ID_cont");
  11.             i++;
  12.             }
  13.             rs.close();
  14.             contas = nC.clone();
  15.             return nC;
  16.         } catch (Exception e) {
  17.             throw e;
  18.         }
  19.        
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement