Retrieve multiple rows from sqlite using where clause Android -


when try retrieve multiple rows sqlite using clause, getting first row... i.e.: mcursor.getcount() returns 1 always...
there way retrieve multiple rows table using clause?
have tried farscreenshot

mypath = db_path + db_name;     mydatabase = sqlitedatabase.opendatabase(mypath, null, sqlitedatabase.open_readonly);     string query= "select * location 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();     } 

your condition retrieves 1 record only.
if have more 1 record emirate = 'qatar', first 1 retrieved, because = condition satisfied.

you need use like operator instead of =, them all.

replace query with:

string query= "select * location emirate '%" + s + "%'"; 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -