2012-11-30 43 views
0

數據值我有日期上升的問題......我想按listDate(日期格式),我認爲有些事情錯在我的代碼的所有日期..上升從SQLite的機器人

public Cursor getAll() { 
     // TODO Auto-generated method stub 
     return (database.rawQuery("SELECT " + SQLiteHelper.listId + " as _id, " 
       + SQLiteHelper.listName + "," + SQLiteHelper.listDate + "," 
       + SQLiteHelper.listDest + " FROM " + SQLiteHelper.listTable 
       + " ORDER BY " + SQLiteHelper.listDate+ "ASC",null)); 

    } 


private static final String CREATE_SHOPPLINGLIST_TABLE = "CREATE TABLE IF NOT EXISTS " 
      + listTable 
      + " (" 
      + listId 
      + " INTEGER PRIMARY KEY AUTOINCREMENT, " 
      + listName 
      + " TEXT, " 
      + listDest + " TEXT," + listDate + " INTEGER)"; 

希望任何人都可以指正我的錯誤...

+0

wat是存儲在數據庫中的listDate的格式 – raju

+0

我存儲整數的listDate – johnk

+0

你如何區別於輸出?換句話說,你的日期格式和你現在得到的是什麼? –

回答

0

試試這個..

return (database.rawQuery("SELECT " + SQLiteHelper.listId + " as _id, " 
       + SQLiteHelper.listName + "," + SQLiteHelper.listDate + "," 
       + SQLiteHelper.listDest + " FROM " + SQLiteHelper.listTable 
       + " ORDER BY " + SQLiteHelper.listDate+ " ASC",null)); 

給空間" ASC"

+0

好趕兄弟 – raju

+0

thx @sunny,很好的接...我糾正它啊......真的都是你...... – johnk