Bonjour,
Je souhaite afficher un champ de ma table dans une JTextField. J'ai alors récupérer les informations de la table dont j'ai besoin de la manière suivante :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public static ArrayList<ClientAS400> getListClientAS400(){
connexion = new BDConnectAS400();
String requete = "SELECT B33STFC.FTPVEL01.* FROM B33STFC.FTPVEL01 ORDER BY CIDIPN FETCH FIRST 10 ROWS ONLY";
//String requete = "SELECT B33STFC.FTPVET01.* FROM B33STFC.FTPVET01 FETCH FIRST 30 ROWS ONLY";
Statement state;
ResultSet res;
ArrayList<ClientAS400> list = new ArrayList<ClientAS400>();
try{
state = connexion.getInstance().createStatement();
res = state.executeQuery(requete);
while(res.next()){
ClientAS400 cltAS400 = new ClientAS400();
cltAS400.setCIDIPN(res.getString(4));
cltAS400.setRSOCPN(res.getString(8));
cltAS400.setTYPVPN(res.getString(6));
cltAS400.setVILLPN(res.getString(17));
list.add(cltAS400);
}
res.close();
return list;
}catch(SQLException e){
}
return null;
} |
ensuite j'ai mis en place ma methode d'affichage de cette manière :
1 2 3 4 5 6 7 8
| public JTextField getTxtAdresse() {
if(txtAdresse == null){
txtAdresse = new JTextField();
txtAdresse.setBounds(10, 40, 300, 22);
txtAdresse.setText(DAOClientAS400.getListClientAS400().get(2));
}
return txtAdresse;
} |
J'avoue que je suis planté sur cette partie du code :
txtAdresse.setText(DAOClientAS400.getListClientAS400()????);
HELP ME PLEASE
Partager