Guest User

Untitled

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