发生错误,已经添加了一个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();
}
}
}
删除私有对象DBUtils然后导入net.proteanit.sql.DbUtils