在我爲我的oracle數據庫中的uni.Im數據從一個表中獲取數據時,一個奇怪的select查詢行爲出現在我的路上。日期列上的選擇查詢的奇怪行爲
selectString = "select * from reservation";
prestatement = dbConnection.prepareStatement(selectString);
rs = prestatement.executeQuery(selectString);
while (rs.next()) {
String rdate = rs.getString("reservdate").substring(0, 10);
jComboBox1.addItem(rdate);
//....
//....etc..
問題是,什麼是顯示在我的組合框是覺得像「1999年10月10日」 之後,我要拉一些數據,其中我必須與選定的日期選擇那些項目在組合框上。好的,這是我的問題。
String x = String.valueOf(jComboBox1.getSelectedItem());
selectString="select * from reservation where reservdate='"+x+"'";
//...etc..
後,我運行即時得到SQL異常與消息:消息:ORA-01861:文字不匹配格式字符串 我搜索一點點網頁,發現,如果我運行這個選擇查詢一切正常細
selectString="select * from reservation where reservdate='10-OCT-99'";
所以我的問題是,什麼是讓這個幹活意味着我應該嘗試編輯所有日期的組合框格式的最佳方式?或者我一直在做錯誤的事情,應該改變這種情況?
在此先感謝。
即時通訊:消息:ORA-01756:引用的字符串未正確終止。 –
現在我回到了我開始的地方:消息:ORA-01861:文字不匹配格式字符串 –
同樣的事情..我也試過mm代替週一,但仍然不能正確地得到它。 –