0
我試圖在月內獲取所有記錄。SQLite Android - geting月
我的日期存儲爲文本(tryed日期),並在一個字符串的Android
我對獲得當前日期方法:
private String getDateTime() {
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss", Locale.getDefault());
Date date = new Date();
return dateFormat.format(date);
}
和我的光標:
public Cursor getCursor(){
return db.rawQuery("Select strftime('%m', " + CN_DATE + ") as valMonth from " + TABLE_NAME + " where valMonth = '05' GROUP BY valMonth)" , null);
}
錯誤:接近「)」:語法錯誤(代碼1):,編譯時:選擇...
thx在您的幫助推進:)
(對不起,我的英語)
thx for ur answer!但現在它說:列'_id'不存在 有一種方法可以將查詢的結果存儲在一個變量中?用於另一個查詢? –
拋出的異常究竟在哪裏?你在使用'CursorAdapter'嗎? – laalto
是的,我使用CursorAdapter來填充自定義列表視圖 –