开发者

Sorting Sqlite data while display

开发者 https://www.devze.com 2023-03-22 05:39 出处:网络
I have \"date\"(TEXT) column in db.I want to display dates in ascending order(i.e. group by date).but according to current date.

I have "date"(TEXT) column in db.I want to display dates in ascending order(i.e. group by date).but according to current date. i.e dates greator or equal t开发者_如何学Gohan current date should be displayed first and past dates should get appended at last in listview automatically.I used SimpleCursorAdapter to display list.

So how should I do this?


Write the proper query and you should be fine. If you are looking for that particular query as an answer to your question, tag it as sql or sqlite as well.


You can sort data items when you try to query..here a cursor object set with parameters(just an example),the 7th parameter With "ASC" means that the return data will be in ascending oder

cursor cur = yourdata.query(TableName, coloumns, null, null,null, null, table.COLUMN_NAME + " ASC");

if you want an example you can try this code example Click me

0

精彩评论

暂无评论...
验证码 换一张
取 消