I'm hitting a wall in an android SQL query, this is what I have so far:
开发者_StackOverflowmDb.query(false, DATABASE_TABLE, new String[] {KEY_ROWID, KEY_ROWONE, KEY_ROWTWO, KEY_ROWTHREE, KEY_ROWFOUR, KEY_ROWFIVE}, KEY_ROWONE +" LIKE '?%'", new String[] { letter }, null, null, null, null);
Basically, I want the query to return all the rows in the table where KEY_ROWONE starts with the variable letter (a string containing one letter).
I get a force close when I'm running the code, and I'm really puzzled.
I promise to tick the best answer!
It's alright guys, panic over, I found the solution:
mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID, KEY_ROWONE, KEY_ROWTWO, KEY_ROWTHREE, KEY_ROWFOUR, KEY_ROWFIVE}, KEY_ROWONE+" LIKE ? || '%'", new String[] { l }, null, null, null, null);
Just in case someone will be interested, here's full database tutorial for android: http://knightswhocode.com/wordpress/?p=14
精彩评论