这是完整的代码:
stat = con.prepareStatement("SELECT ExcelTable.PayorBankRoutNo, ExcelTable.Amount, ExcelTable.AccountNo, ExcelTable.SerialNo, ExcelTable.PresentingBankRoutNo, ExcelTable.PresentmentDate FROM ExcelTable WHERE ExcelTable.CreationDate = ? INNER JOIN (SELECT PayorBankRoutNo, Amount, AccountNo, SerialNo FROM ExcelTable GROUP BY PayorBankRoutNo, Amount, AccountNo, SerialNo HAVING (count(PayorBankRoutNo) > 1) AND (count(Amount) > 1) AND (count(AccountNo) > 1) AND (count(SerialNo) > 1)) dup ON ExcelTable.PayorBankRoutNo = dup.PayorBankRoutNo AND ExcelTable.Amount = dup.Amount AND ExcelTable.AccountNo = dup.AccountNo AND ExcelTable.SerialNo = dup.SerialNo ORDER BY ExcelTable.SerialNo");
stat.setString(1, dateName);
rs = stat.executeQuery();
metadata = rs.getMetaData();
li_cols = metadata.getColumnCount();
allRows = new Vector();
while(rs.next())
{
Vector newRow = new Vector();
for(int i=1; i<= li_cols; i++)
{
newRow.addElement(rs.getObject(i));
}
allRows.addElement(newRow);
}fireTableStructureChanged();
}
catch(Exception e)
{
e.printStackTrace();
System.err.println("Error "+e);
}
}
public int getColumnCount()
{
return li_cols;
}
public int getRowCount()
{
return allRows.size();
}
public Object getValueAt(int aRow, int aCol)
{
row = (Vector)allRows.elementAt(aRow);
return row.elementAt(aCol);
}
public Class getColumnClass(int col)
{
return getValueAt(0, col).getClass();
}
public boolean isCellEditable(int row, int col)
{
return false;
}
public String getColumnName(int aCol)
{
return columnNames[aCol];
}
String[] columnNames = {"PAYORBANKROUTNO", "AMOUNT", "ACCOUNTNO", "SERIALNO", "PRESENTINGBANKROUTNO", "PRESENTMENTDATE"};
}