SQL using with clause not working

Posted by user1290467 on Stack Overflow See other posts from Stack Overflow or by user1290467
Published on 2012-11-15T10:58:03Z Indexed on 2012/11/15 10:59 UTC
Read the original article Hit count: 406

Filed under:
|
|

My question is why this query does not work?

Cursor c = db.rawQuery("SELECT * FROM tbl_staff WHERE PMajor = '%" + spin.getSelectedItem().toString() + "%'", null);



Cursor c: it is a cursor for handling my query

tbl_staff: my table that consist of PName,PMajor,PCert

spin: is spinner that has values which I need for my database query.


When I use:
if (c.moveToNext())
else (log.d("error query","couldn't do the query!");)

It goes to else statement and moveToNext() doesn't work.

© Stack Overflow or respective owner

Related posts about android

Related posts about database