I am trying to make an attendance system with QR generator and scanner using zxing. QR part is working fine but I have one problem right now. When the QR code get scanned, I want it to automatically filter the table/database with the same serial number through textfield (I am using setText to pass the text on QR to textfield.
Code for Filter:
try {
con = DriverManager.getConnection("jdbc:mysql://localhost/studentlogin", "root", "");
String sql = "SELECT * FROM studentqrlogin WHERE " + "SN like '%" + tfSearch.getText() + "%'";
pst = con.prepareStatement(sql);
rs = pst.executeQuery();
jtTable.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
So far, I have this code on a key released event. I also tried adding it to other event listener but it doesn't work like I want it to be.