Rather than arranging this records while inserting, you should do it while
retrieving the records by using the ORDER BY clause.


On Wed, Nov 17, 2010 at 9:06 AM, pramod.deore <[email protected]>wrote:

> Sorry in subject line I say 'arrange primary key in ascending order'
> but roomID is not primary key.
>
> On Nov 17, 8:34 am, "pramod.deore" <[email protected]> wrote:
> > I have a table like this
> >
> > public void insertToSwitchTable(String switchName,int roomID,String
> > roomName)
> > {
> > sampleDB.execSQL("CREATE TABLE IF NOT EXISTS " +
> >                     SWITCH_TABLE_NAME +
> >                     "(SwitchID integer primary key
> > autoincrement,SwitchName VARCHAR,RoomID integer,RoomName VARCHAR);");
> >
> >                 sampleDB.execSQL("INSERT INTO " +
> >                                 SWITCH_TABLE_NAME +
> >                                 " Values
> (null,'"+switchName+"','"+roomID+"','"+roomName
> > +"');");
> >
> > }
> >
> > Now I want to arrange the records according to ascending order of
> > RoomID. How to do this?
> >
> > Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

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

Reply via email to