I made this for myself and it works
I created a class named fro example dbFile
public class DbFile  {
static Cursor getAll(SQLiteDatabase db) {
return(db.rawQuery("SELECT * FROM TableName ORDER BY ColumnName",
null));
}
}

and from my activity class i declare
Cursor model=null;
and on create i call:
model=DbFile.getAll(db);


2010/11/22 pramod.deore <deore.pramo...@gmail.com>

> I have still the problem. I read at
>
>
> http://books.google.co.in/books?id=2XeNswkT_2YC&pg=PA232&lpg=PA232&dq=order+by+clause+android&source=bl&ots=omdYC77sPU&sig=xsqE8Pp29uTnjVAaxwDbr2vN7Xs&hl=en&ei=wjzqTKaLGMilcMGo_dUK&sa=X&oi=book_result&ct=result&resnum=4&ved=0CCgQ6AEwAzgK#v=onepage&q=order%20by%20clause%20android&f=false
>
> as it write query as
> constantsCursor = db.rawQuery("SELECT _ID ,title,value" +
> "FROM constants ORDER BY title",null);
>
> I also tried like above
>
> Cursor c = sampleDB.rawQuery ("SELECT
> SwitchID,SwitchName,RoomID,RoomName"+
>                                "From SwitchTable ORDER BY RoomID",null);
>
> But still not getting output.
>
>
> On Nov 22, 9:56 am, "pramod.deore" <deore.pramo...@gmail.com> wrote:
> > I had also tried as
> >
> > Cursor c = sampleDB.query(SWITCH_TABLE_NAME, new String[]
> >                             {"SwitchID,SwitchName,RoomID,RoomName"},
> "RoomID=
> > ",null,null,null," ASC");
> >
> > But still it is not working.Any clue?
> >
> > On Nov 22, 9:13 am, "pramod.deore" <deore.pramo...@gmail.com> wrote:
> >
> > > Hi ,
> > > I have a table that has 4 columns.There is no primary key in that
> > > table. Now I want to retrieve table data according to ascending order
> > > of one column (say ascending order of RoomID). I had tried it as
> >
> > > Cursor c = sampleDB.query(SWITCH_TABLE_NAME, new String[]
> > >                             {"SwitchID,SwitchName,RoomID,RoomName"},
> > > "RoomID"+ " ASC" ,null, null, null, null);
> >
> > > But it doesn't work. Anyone know what is wrong here?
> > > Thanks
> >
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to