Advertisement
Guest User

Untitled

a guest
Jun 6th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. public ArrayList<Annonce> mesannonces(Membre membre){
  2. Annonce annonce = new Annonce();
  3. try {
  4. Class.forName("org.postgresql.Driver");
  5. java.sql.Connection c=DriverManager.getConnection("jdbc:postgresql://localhost:5432/prjFinal","postgres","azer");
  6. PreparedStatement p=c.prepareStatement("select*from annonce where id_client=? ;");
  7. p.setInt(1, membre.getId_membre());
  8. ResultSet s= p.executeQuery();
  9. while (s.next()){
  10. annonce = new Annonce();
  11. annonce.setId_annonce(s.getInt("id_annonce"));
  12. annonce.setId_client(s.getInt("id_client"));
  13. annonce.setId_freelancer(s.getInt("id_freelancer"));
  14. annonce.setTitre(s.getString("titre"));
  15. annonce.setType(s.getString("type"));
  16. annonce.setDelai(s.getInt("delai"));
  17. annonce.setBudget(s.getInt("budget"));
  18. annonce.setDate_ajout(s.getDate("date_ajout"));
  19. annonce.setDesc(s.getString("desc"));
  20. annonce.setEtat(s.getString("etat"));
  21. liste.add(annonce);
  22. }
  23. } catch (Exception e) {
  24. e.printStackTrace();
  25. }
  26. return liste;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement