Search code examples
androidsqlitelogcat

Logcat incorrectly says there is no such column in SQLite database - Android SQLite


At the top of this Logcat it says there is no such column where name == Ben10. However, at the bottom of this Logcat I have logged the users with thier imagePath, then id, then name, then password. Ben10a signifies the name Ben10 with password a. So there is a column where name is Ben10.

12-31 02:05:10.195: D/dalvikvm(1091): GREF has increased to 201
    12-31 02:05:16.105: E/dbHelper(1091): SELECT  * FROM AppUser WHERE name = Ben10
    12-31 02:05:16.105: E/SQLiteLog(1091): (1) no such column: Ben10
    12-31 02:05:16.235: D/Get database Items(1091): Getting all database items
    12-31 02:05:16.245: E/dbHelper(1091): SELECT  * FROM ClothingItem
    12-31 02:05:16.256: E/dbHelper(1091): SELECT  * FROM AppUser
    12-31 02:05:16.256: D/ClothingItem(1091): 1hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 2hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 3hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 4hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 5hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 6hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 7hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 8hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 9hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 10hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 11hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 12hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 13hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 14hathat1
    12-31 02:05:16.285: D/User(1091): content://media/external/images/media/121Bena
    12-31 02:05:16.285: D/User(1091): content://media/external/images/media/122Ben10a
    12-31 02:05:16.315: D/dalvikvm(1091): GC_CONCURRENT freed 140K, 2% free 12075K/12295K, paused 72ms+30ms, total 164ms

Solution

  • Use apostrophes for enclosing strings in sql-queries. So try this:

    select * from AppUser where name = 'Bem10'