Skip to content Skip to sidebar Skip to footer

"table * Has No Column Named * " Error, Sqlite

I'm trying to learn SQLite, trying basic things and (as expected) it doesn't really work. I've tried to create another DB (different file), but the error remains the same. 03-05 17

Solution 1:

The error just says, that the table mytable does not contain the requested column date. No magic beyond this.

You should drop and create the table again and ensure, that it has the right columns. Please note that your onCreate Method contains an error. A , is missing after time text. So basically your DB table is not even created in this method as the SQL is invalid.

Try creating the table in onCreate() with the following code:

      db.execSQL("create table mytable ("
          + "id integer primary key autoincrement," 
          + "glucose text,"
          + "time text," // added a ','
          + "date text" + ");");

Solution 2:

Only adding a , would do the trick create table sql failed to create a table so it is using the previous version of the table

Solution 3:

I was having this error when I was 100% certain my table contained that column.After hours of trying EVERYTHING I could, I checked the table and discovered it still had the old column names I changed while making changes to my code and these column names didn't match the column names in my code.I uninstalled the app on my device and reinstalled and the problem was solved.

Solution 4:

check your columns match the spell and are inserted in the query. Also check your query colons and commas (,) and (") are properly inserted.

Post a Comment for ""table * Has No Column Named * " Error, Sqlite"