0
什麼是正確的方法,所以我可以查詢此聲明,其中來自jdatechooser的日期將是我的參數jdatechooser作爲參數在MySQL查詢
DefaultTableModel model= (DefaultTableModel)DisplayRecieveTB.getModel();
DisplayRecieveTB.revalidate();
model.getDataVector().removeAllElements();
try{
String date = DateChooserRS.getDate().toString();
stmt = conn.createStatement();
stmt.executeQuery("SELECT *FROM supplyrecievable where recievedate = '"+date+"' ");
rs = stmt.getResultSet();
while (rs.next())
{
String r1 = rs.getString("itemname");
String r2 = rs.getString("itemgroup");
String r3 = rs.getString("itemcount");
String r4 = rs.getString("totalcost");
String r5 = rs.getString("itemcode");
model.addRow(new Object[] {r5,r1,r2,r3,r4});
DisplayRecieveTB.revalidate();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
}
謝謝主席先生:) – Pyne