lundi 15 juin 2015

Retrieve multiple rows from sqlite using where clause Android

When I am trying to retrieve multiple rows from sqlite using where clause, I am getting only the first row... ie, mCursor.getCount(), returns 1 always... is there any way to retrieve multiple rows from a table using where clause... THis is what i have tried so far...ScreenShot

myPath = DB_PATH + DB_NAME;
    myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
    String query= "SELECT * FROM location where emirate='"+s+"'";
    Cursor mCursor = myDataBase.rawQuery(query, null);
    int i= mCursor.getCount();
    if (i>0) {
           mCursor.moveToFirst();
           shoplist.add(mCursor.getString(1));
        }
        mCursor.close();
        myDataBase.close();
    }

Aucun commentaire:

Enregistrer un commentaire