Guest User

Untitled

a guest
Jan 19th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public void tampil(int port){
  2. try {
  3. Class.forName("com.mysql.jdbc.Driver");
  4. java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/port","root","");
  5. java.sql.Statement st = con.createStatement();
  6. String query = "select nama_pc,ip,mac,aset from pc where id_pc =\"" + port + "\"";
  7. ResultSet rs = st.executeQuery(query);
  8. rs.next();
  9.  
  10. // JOptionPane.showMessageDialog(this, "Data Komputer tersimpan...");
  11. String nm = rs.getString(1);
  12. tfnama.setText(nm);
  13. String ip = rs.getString(2);
  14. tfip.setText(ip);
  15. String mac = rs.getString(3);
  16. tfmac.setText(mac);
  17. String aset = rs.getString(4);
  18. tfaset.getText();
  19. //dispose();
  20. }catch(Exception e){
  21. System.out.println(e.getMessage());
  22. }
  23.  
  24.  
  25. }
Add Comment
Please, Sign In to add comment