-1
String sql =「SELECT TOP 10 id,Trailer,Block,Location,Day,SetTime,Comment FROM TrailerLocation」 +「ORDER BY id DESC」;SQL查詢輸出到一個Joptionpane
rs = st.executeQuery(sql);
while(rs.next()){
//Retrieve by column name
int id = rs.getInt("id");
String trailer = rs.getString("Trailer");
String block = rs.getString("Block");
String location = rs.getString("Location");
String date = rs.getString("Day");
String comment = rs.getString("Comment");
//Display values
JOptionPane.showMessageDialog(null,
"ID: " + id
+ ", Trailer: " + trailer
+ ", Block: " + block
+ ", Location: " + location
+ ", Date & Time: " + date
+ ", Comment: " + comment);
}
我想讓Joptionpane只顯示一次,所有數據都不是十次。
這個問題無關,與任何SQL。 –