Reputation: 45
I want to execute a ManagedQuery but am getting a error in my log:
Query
Cursor cursor = managedQuery(GroceryListContentProvider.NOTES_URI,projection,Notes.NOTE_TITLE+"="+S+" AND "+ Notes.NOTE_DATE+"="+S1, null, null);
Error Log
02-21 16:00:52.395: E/AndroidRuntime(22534): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.schuemie.GroceryList/net.schuemie.GroceryList.shoppinglist}: android.database.sqlite.SQLiteException: near "new": syntax error: , while compiling: SELECT item_name FROM notes WHERE (title=shop new AND date=12/2/12) ORDER BY title
Upvotes: 1
Views: 104
Reputation: 2795
Update
String where = "title='"+nameOfTitle+"' And date="+date+" ";
Cursor cursor = managedQuery(GroceryListContentProvider.NOTES_URI,null,where,null,null);
Upvotes: 0
Reputation: 2972
remove "new" from query and add quotes to string values
SELECT item_name FROM notes WHERE (title='shop' AND date=12/2/12) ORDER BY title
Upvotes: 1