CODING JAVA CARI / SCRIPT CARI
DefaultTableModel tabelnyo = new DefaultTableModel();
tabelnyo.addColumn("kode");
tabelnyo.addColumn("NAMA");
try{
koneksi();
String sql = "Select * from barang where kode like '%" + jTextField3.getText() + "%'" +
"or nama like '%" + jTextField3.getText() + "%'";
Statement stat = conn.createStatement();
ResultSet rs=stat.executeQuery(sql);
while (rs.next()) {
tabelnyo.addRow(new Object[]{
rs.getString(1),
rs.getString(2)
});
}
jTable1.setModel(tabelnyo);
}catch (Exception e){
}