ChyBy
ChyBy

Reputation: 1685

sqlite error querying Android

I'm trying to recover from my database the list of songs downloaded with my program.

Cursor c = mDb.query(DB_TABLE_SONGS, null, KEY_SONG_DOWNLOADED+" = true", null, null, null, null);

And I receive that error

android.database.sqlite.SQLiteException: no such column: true: 

while compiling:

SELECT * FROM songs WHERE downloaded = true  

Upvotes: 0

Views: 114

Answers (1)

Rasel
Rasel

Reputation: 15477

Your are missing '' for comparing to a string type column.Try this

Cursor c = mDb.query(DB_TABLE_SONGS, null, KEY_SONG_DOWNLOADED+" = 'true'", null, null, null, null);

Upvotes: 1

Related Questions