Re: [android-developers] Re: order by clause

2010-11-22 Thread ΠΑΣΧΑΛΗΣ ΠΛΙΑΧΑΣ
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_2YCpg=PA232lpg=PA232dq=order+by+clause+androidsource=blots=omdYC77sPUsig=xsqE8Pp29uTnjVAaxwDbr2vN7Xshl=enei=wjzqTKaLGMilcMGo_dUKsa=Xoi=book_resultct=resultresnum=4ved=0CCgQ6AEwAzgK#v=onepageq=order%20by%20clause%20androidf=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.comandroid-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

Re: [android-developers] Re: order by clause

2010-11-22 Thread ΠΑΣΧΑΛΗΣ ΠΛΙΑΧΑΣ
If you work on Eclipse try to read carefully the Console and logCat window,
maybe there you'll find the answer

Στις 22 Νοεμβρίου 2010 1:38 μ.μ., ο χρήστης pramod.deore 
deore.pramo...@gmail.com έγραψε:


 Hi, ΠΑΣΧΑΛΗΣ ΠΛΙΑΧΑΣ yes it solves my problem. But I don't understand
 what earlier query not work.

 On Nov 22, 4:28 pm, ΠΑΣΧΑΛΗΣ ΠΛΙΑΧΑΣ plia...@gmail.com wrote:
  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_2YCpg=PA232lpg=PA232dq.
 ..
 
   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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@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.comandroid-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