Reputation: 201
As the title says I am having a little trouble with a query on an sqlite database.Basically, what I am trying to do is retrieve a bunch of quotes from the database, depending on the author chosen from user in a list.
But there is a problem with my SELECT statement(it seems..), and I can't seem to spot it, so if any of you good folk could lend a pair of eyes I would really appreciate it.
My query:
public Cursor getQuotes(int position){
String who = authorName[position];
return qmDB.query(QUOTES_TABLE, new String[]{
KEY_QUOTE
},
KEY_AUTHNAME + "=" + who,
null,
null,
null,
null);
}
Error:
04-28 20:05:10.685: ERROR/AndroidRuntime(25017): Caused by: android.database.sqlite.SQLiteException: near "Anton": syntax error: , while compiling: SELECT quote FROM Quotes WHERE auth_name=Robert Anton Wilson
Upvotes: 0
Views: 720