Sqlite query troble
i am doing android project by using sqlite db ,in select query i have e开发者_开发问答rror that is cursor bound exception (0) ,my query is :
Cursor c = myDB.rawQuery("SELECT * FROM COMPDETAIL WHERE city='Bangalore' AND service='Hospital';");
by replacing AND by OR it working..
what am I suppose to do, if I want COMPDETAIL by multiple conditions...
Thanks in Advance,
use moveToFirst():
if (c != null) {
if (c.moveToFirst()) {
do { ...
Are you sure such row (with city = 'Bangalore' and service = 'Hospital') exists in your database? AND
is perfectly legal keyword in SQLite, there's no reason it wouldn't work and OR
would... unless, there's no row matching both criteria, and you still try to fetch it - which will produce something along the lines of out of bounds exception.
精彩评论