Can anybody tell me what I am doing wrong? The table that I am querying is empty, so I think that the cursor should be empty. But instead, it returns a cursor with 1 row and 1 column. Even so, I don’t see why this results in an error. All I am trying to do is return the single value (if it exists) from my query.
Can somebody help me understand this? Thank you!
Cursor cursor = db.rawQuery("SELECT max(GAME_COLUMN) FROM GAMES_TABLE", null);
if (cursor.moveToNext()) {
System.err.println("why am I here?");
nextGame = cursor.getInt(cursor.getColumnIndex("GAME_COLUMN"));
}
Bad request for field slot 0,-1. numRows = 1, numColumns = 1
This is because there is no column named GAME_COLUMN in the result. Make your query
and then query for GC :-