Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java.sql.Connection conexion=DriverManager.getConnection("jdbc:mysql://localhost/bdpro","root" ,"");
- java.sql.Statement comando=conexion.createStatement();
- ResultSet registro = comando.executeQuery("select nombre,precio,fecha,foto from tablapro where id="+textField.getText());
- if (registro.next()==true) {
- textField_1.setText(registro.getString("nombre"));
- textField_2.setText(registro.getString("precio"));
- Date Estado = registro.getDate("fecha");
- dateChooser.setDate(Estado);
- Blob Blob = (Blob) registro.getBlob(4);
- byte[] imageByte = Blob.getBytes(1, (int) Blob.length());
- InputStream is=new ByteArrayInputStream(imageByte);
- BufferedImage imag=ImageIO.read(is);
- Image image=Toolkit.getDefaultToolkit().createImage(imageByte);
- ImageIcon icono = new ImageIcon(image);
- lblFoto.setIcon(TamañoImg(null,icono));
- }
- conexion.close();
- } catch(SQLException | IOException ex){
- JOptionPane.showMessageDialog(null, ex.getMessage());
- }
Add Comment
Please, Sign In to add comment