与DB H2的Java连接

时间:2019-02-28 11:25:56

标签: java

当您单击搜索按钮时,没有任何反应

public class SearchAktion implements ActionListener{

    @Override
    public void actionPerformed(ActionEvent e) {

        conn = DBConnector.getConnection();
        String search = searchJTField.getText();
        String sql = " SELECT * FROM car  WHERE model LIKE '%"+search+"%'";
        try {
            //conn = DBConnector.getConnection();
            state = conn.prepareStatement(sql);
            state.execute();
            refreshTable();
            resetForm();
        } catch (SQLException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }

}// end search action

0 个答案:

没有答案