示例#1
0
 public TO consultaID(String id) throws Exception {
   Connection con = new Conexao().getConexao(dbf.getArquivo().getPath());
   ResultSet rs;
   PreparedStatement ps = con.prepareStatement("SELECT * FROM GERNFEIT WHERE NUMR_NFE = ?");
   ps.setString(1, id);
   rs = ps.executeQuery();
   TO to2 = new TO();
   if (rs.next()) {
     to2.setNum_nfe(rs.getString("NUMR_NFE"));
     to2.setMod_nfece(rs.getString("MODL_NFECE"));
     to2.setDes_prod(rs.getString("DESC_PROD"));
     to2.setQtde_prod(rs.getInt("QTDE_PRODT"));
     to2.setVal_unit(rs.getDouble("VALR_UNITT"));
     to2.setVal_desc(rs.getDouble("VALR_DESCN"));
     to2.setVal_total(rs.getDouble("VALR_TOTAL"));
   }
   con.close();
   return to2;
 }
示例#2
0
 public ArrayList<TO> consultarTodos(TO to) throws Exception {
   ArrayList gern = new ArrayList();
   Connection con = new Conexao().getConexao(dbf.getArquivo().getPath());
   ResultSet rs;
   PreparedStatement ps = con.prepareStatement("SELECT * FROM GERNFEIT ORDER BY NUMR_NFE");
   rs = ps.executeQuery();
   while (rs.next()) {
     TO to2 = new TO();
     to2.setNum_nfe(rs.getString("NUMR_NFE"));
     to2.setMod_nfece(rs.getString("MODL_NFECE"));
     to2.setDes_prod(rs.getString("DESC_PROD"));
     to2.setQtde_prod(rs.getInt("QTDE_PRODT"));
     to2.setVal_unit(rs.getDouble("VALR_UNITT"));
     to2.setVal_desc(rs.getDouble("VALR_DESCN"));
     to2.setVal_total(rs.getDouble("VALR_TOTAL"));
     gern.add(to2);
   }
   con.close();
   return gern;
 }