Try this:
sampleDB.execSQL("SELECT RoomID FROM " +ROOM_TABLE_NAME+"where
RoomName='"+selectedRoom + "'");
In case you cannot see the difference, wrap your room name in single
quotes, so that your query passed to SQLite is:
SELECT ... WHERE RoomName='Bathroom'
Daniel
On Thu, Nov 11, 2010 at 6:50 AM, pramod.deore <[email protected]> wrote:
> Hi ,
>
> I have a table in that there is 2 columns. Now I want to retrieve the
> value of one column using value of second column (Means suppose my
> table name is roomtable. and it contains 2 columns as RoomID and
> RoomName)
>
> Now I know value of RoomName and I want to find out value of
> RoomID. How to this?
> I had tried using following but not succeed.
>
> final String ROOM_TABLE_NAME = "roomtable";
> sampleDB = this.openOrCreateDatabase(SAMPLE_DBNAME, MODE_PRIVATE,
> null);
>
> sampleDB.execSQL("SELECT RoomID FROM " +ROOM_TABLE_NAME+"where
> RoomName="+selectedRoom);
>
> how to execute this query so I can get RoomID?
> 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]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Daniel Drozdzewski
--
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