错误:找不到符号(resultSetToTableModel)

时间:2018-12-02 06:04:49

标签: java swing jar

有错误,已经添加了一个rs2xml.jar,但是在项目清理和构建时显示此错误-错误:找不到符号                 jTable1.setModel(DbUtils.resultSetToTableModel(rs));
不明白,请帮助我。

private void productCodeKeyReleased(java.awt.event.KeyEvent evt) {                                        
    String tf=productCode.getText();
    PreparedStatement ps = null;
    ResultSet rs = null;
    Result rt = null;
    Connection con = getCon();
    try {
        if(tf.matches("^[0-9]+$")){
            String query = "SELECT * FROM product WHERE ProductCode="+tf;
            ps = con.prepareStatement(query);
            rs=ps.executeQuery();
            jTable1.setModel(DbUtils.resultSetToTableModel(rs));//error show here
        }else{
            String query1 = "SELECT * FROM product WHERE ProductName LIKE'%"+tf+"%'";
            ps = con.prepareStatement(query1);
            rs=ps.executeQuery();
            jTable1.setModel(DbUtils.resultSetToTableModel(rs));// error show here
        }
    } catch (Exception e) {
        e.printStackTrace();
    }finally{
    try {
        if(ps!=null){
            rs.close();
            ps.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    }
}

1 个答案:

答案 0 :(得分:0)

删除 私有对象DBUtils 然后导入 net.proteanit.sql.DbUtils