过年前 问最后一个问题 关于SWING的jdbTable 如何刷新数据 给大家拜年了
问题:jdbTable1每刷新一次 自动把上一次数据给加进来了 与预想不符
解决方法:先重写jdbTable1 然后刷仅刷新符合条件的数据 这里不知道该如何做?请大家帮帮忙
public class ScrapEquipmentSearch extends JFrame
{
public ScrapEquipmentSearch()
{
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
.........
database1.setConnection(new ConnectionDescriptor( "jdbc:odbc:SDB ", "sa ",
"123 ", false, "sun.jdbc.odbc.JdbcOdbcDriver "));
queryDataSet1.setReadOnly(true);
queryDataSet1.setSort(new com.borland.dx.dataset.SortDescriptor( " ",
new String[] { "ID "}, new boolean[] {false, }, null, 0));
queryDataSet1.setStoreClassFactory(null);
queryDataSet1.setAccumulateResults(true);
queryDataSet1.setQuery(new QueryDescriptor(database1,
"Select * from AppendEquipmentRegister where if_scrap =1 ", null, true,
Load.ALL));
.............
jdbTable1.setDataSet(queryDataSet1);
tableScrollPane1.setBorder(BorderFactory.createEtchedBorder());
tableScrollPane1.setDebugGraphicsOptions(0);
jComboBox1.setForeground(Color.red);
jButton3.setToolTipText( " ");
jButton3.setText( "刷新 ");
jButton3.addActionListener(new ScrapEquipmentSearch_jButton3_actionAdapter(this));
jComboBox2.setForeground(Color.red);
jComboBox2.addItemListener(new ScrapEquipmentSearch_jComboBox2_itemAdapter(this));
jPanel1.add(jButton2, new XYConstraints(667, 6, 90, 37));
jPanel1.add(jCheckBox1, new XYConstraints(443, 12, -1, -1));
jPanel1.add(jButton1, new XYConstraints(562, 6, 90, 37));
jPanel1.add(jLabel1, new XYConstraints(7, 15, -1, -1));
this.getContentPane().add(tableScrollPane1,
new XYConstraints(45, 89, 798, 351));