Hi Bibek Thanks,
I had tried it as
public int getCurrentSwitchID(int rID)
{
System.out.println ("Here rID is"+rID);
try
{
sampleDB = this.openOrCreateDatabase(SAMPLE_DBNAME,
MODE_PRIVATE, null);
Cursor c23 = sampleDB.query(SWITCH_TABLE_NAME, new
String[]
{"SwitchID"}, null, null, null, null, "RoomID = 'rID'");
int count = c23.getCount();
System.out.println ("Total is"+count); //but here it
prints
all rows count
}
catch (SQLiteException se )
{
se.printStackTrace();
}
return sid;
}
when I print count values from cursor then it prints total number of
rows insted pf printing number of rows whose RoomId is say 3.
On Nov 17, 10:33 am, Kumar Bibek <[email protected]> wrote:
> Read up about simple SQL Statements and then you can use the sampleDB's
> query method to get a cursor.
>
> On Wed, Nov 17, 2010 at 10:59 AM, pramod.deore
> <[email protected]>wrote:
>
>
>
> > I have a table like
>
> > 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 list of all switchName whose roomId say suppose 3. How to
> > do this?
>
> > --
> > 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 Bibekhttp://techdroid.kbeanie.comhttp://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