Android : Table has no column named "variable name" MySql Database error

So basicly I found the solution. I'm still confused about how stupid it was. And clearly database work i super-sensitive material! My problem was I forgot a white-space in the last "INTEGER" value. So instead of " INTEGER" i wrote "INTEGER", and that gave me a row called "bruttoINTEGER" instead of "brutto". So a white-space was the error. I rewrote the createTable function to this :

 public void onCreate(SQLiteDatabase db) {
   String CREATE_DAY_TABLE = "CREATE TABLE " + TABLE_DAYS + "(" 
 + KEY_ID + " INTEGER PRIMARY KEY," + KEY_DATE + " TEXT," + KEY_HOURS + " INTEGER, " 
 + KEY_UB + " INTEGER," + KEY_BRUTTO + " INTEGER" + ");"; 
 db.execSQL(CREATE_DAY_TABLE);
 }

private static final int VERSION = 4;

Change the version it worked fine for me


i agree with iNzzane above. this problem is mainly caused by syntax. for example, previously my code was correct. here it is:

String CREATE_PRODUCTS_TABLE = "CREATE TABLE " + TABLE_PRODUCTS + "("
                + COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_MESSAGEADDRESS
                + " TEXT," + COLUMN_MESSAGEBODY + " TEXT " + ")";

the above code was running correct but i added another column and it started causing the mentioned error. below is the erroneous code:

String CREATE_PRODUCTS_TABLE = "CREATE TABLE " + TABLE_PRODUCTS + "("
                + COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_MESSAGEADDRESS
                + " TEXT," + COLUMN_MESSAGEBODY + " TEXT" + COLUMN_MESSAGETIME + " LONG" + ")";

as you can see, when i added the new column i forgot to include a comma after type TEXT. this means that when this code is executed, there will be syntax error as the compiler will read the last part as:

COLUMN_MESSAGEBODY TEXTCOLUMN_MESSAGETIME LONG

as opposed to:

COLUMN_MESSAGEBODY TEXT, COLUMN_MESSAGETIME LONG

solution: ensure that your syntax is correct and you heed to spaces and commas.