vendredi 10 juillet 2015

Sqlite error (missing database) while trying to update jtable

private void checkKeyPressed(java.awt.event.KeyEvent evt) {                                 
    try{
        String ch ="select * from check where name like ?%";
        PreparedStatement pst=conn.prepareStatement(ch);
        pst.setString(1, check.getText());
        ResultSet rs=pst.executeQuery();
        checker.setModel(DbUtils.resultSetToTableModel(rs));

    }catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
} 

above is the code im using, and im getting a:

java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "check": syntax error)

i have a table named check in sqlite, and im trying to create a search engine in my jframe, so when i enter text in a textfield the jtable filters automatically. any idea why this error could come about.

Aucun commentaire:

Enregistrer un commentaire