Sunday, 11 August 2013

how to retrieve image after saving

how to retrieve image after saving

Hello World? I'm new in programing, I'm using eclipse kepler including
JBuilder, I have a problem,In my application I can save this image of
employee in mysql, but after to save it I can not retrieve would you any
one help me please? this is the code I'm using to retrieve my image
try{
String sql=(" Select
idemploye,nomemploye,prenomemploye,telephone,carteidentite,date,
image from employe where idemploye = \'"
+idemploye+"\'");
Statement state =
Connection_bd.getInstance().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet res = state.executeQuery(sql);
if(res.next())
{
byte[]imagedata=res.getBytes("image");//image=nom de
la colonne photo
format=new ImageIcon(imagedata);
lblNewLabel_2.setIcon(format);
}
bdfonction(sql,panel_31,panel_36);
res.close();
state.close();
}catch(Exception e){e.printStackTrace();}

No comments:

Post a Comment