I am using try catch
block to filter the data from the sqlite database
, i have two issues this program is case sensitive i need it to be non case sensitive, then it filter the data only when i write the exact name given in the database. Please help to make it a dynamic filter.
textFieldSearch = new JTextField();
textFieldSearch.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent arg0) {
try {
String query = "select sno,universityname,state,courses,applicationfees,deadline,admissionrequirment,undergrad,grad from UsaCollegeList where state=? ";
PreparedStatement pst = connection.prepareStatement(query);
pst.setString(1, (String)textFieldSearch.getText());
ResultSet rs=pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
pst.close();
} catch (Exception e) {
// TODO: handle exception
JOptionPane.showMessageDialog(null, "error");
e.printStackTrace();
}
}
});