Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PC() {
- initComponents();
- //tampil(int port); ini diisi/g mas??
- }
- public void tampil(int port){
- try {
- Class.forName("com.mysql.jdbc.Driver");
- java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jaringan","root","");
- java.sql.Statement st = con.createStatement();
- String query = "select nama_pc,ip,mac,aset from pc where id_pc =\"" + port + "\"";
- ResultSet rs = st.executeQuery(query);
- rs.next();
- // JOptionPane.showMessageDialog(this, "Data Komputer tersimpan...");
- String nm = rs.getString(1);
- tfnama.setText(nm);
- String ip = rs.getString(2);
- tfip.setText(ip);
- String mac = rs.getString(3);
- tfmac.setText(mac);
- String aset = rs.getString(4);
- tfaset.getText();
- //dispose();
- }catch(Exception e){
- System.out.println(e.getMessage());
- }
- }
Add Comment
Please, Sign In to add comment